https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MooseEigenSystem Class Reference

#include <MooseEigenSystem.h>

Inheritance diagram for MooseEigenSystem:
[legend]

Public Types

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

Public Member Functions

 MooseEigenSystem (FEProblemBase &problem, const std::string &name)
 
virtual ~MooseEigenSystem ()
 
virtual void addKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a kernel. More...
 
virtual void markEigenVariable (const VariableName &var_name)
 Mark a variable as a variable of the eigen system. More...
 
void scaleSystemSolution (SYSTEMTAG tag, Real scaling_factor)
 Scale the solution vector. More...
 
void combineSystemSolution (SYSTEMTAG tag, const std::vector< Real > &coefficients)
 Linear combination of the solution vectors. More...
 
void initSystemSolution (SYSTEMTAG tag, Real v)
 Initialize the solution vector with a constant value. More...
 
void initSystemSolutionOld (SYSTEMTAG tag, Real v)
 
void eigenKernelOnOld ()
 Ask eigenkernels to operate on old or current solution vectors. More...
 
void eigenKernelOnCurrent ()
 
void buildSystemDoFIndices (SYSTEMTAG tag=ALL)
 Build DoF indices for a system. More...
 
bool activeOnOld ()
 Return if eigen kernels should be on old solution. More...
 
const std::set< VariableName > & getEigenVariableNames () const
 Get variable names of the eigen system. More...
 
bool containsEigenKernel () const
 Weather or not the system contains eigen kernels. More...
 
virtual void solve () override
 Solve the system (using libMesh magic) More...
 
virtual void stopSolve (const ExecFlagType &exec_flag, const std::set< TagID > &vector_tags_to_close) override
 Quit the current solve as soon as possible. More...
 
virtual unsigned int getCurrentNonlinearIterationNumber () override
 Returns the current nonlinear iteration number. More...
 
virtual void setupFiniteDifferencedPreconditioner () override
 
virtual bool converged () override
 Returns the convergence state. More...
 
virtual NumericVector< Number > & RHS () override
 
virtual libMesh::NonlinearSolver< Number > * nonlinearSolver () override
 
virtual SNES getSNES () override
 
virtual libMesh::NonlinearImplicitSystemsys ()
 
virtual void attachPreconditioner (libMesh::Preconditioner< Number > *preconditioner) override
 Attach a customized preconditioner that requires physics knowledge. More...
 
virtual void residualAndJacobianTogether () override
 Call this method if you want the residual and Jacobian to be computed simultaneously. More...
 
virtual void potentiallySetupFiniteDifferencing () override
 Create finite differencing contexts for assembly of the Jacobian and/or approximating the action of the Jacobian on vectors (e.g. More...
 
virtual void preInit () override
 This is called prior to the libMesh system has been init'd. More...
 
void reinitMortarFunctors ()
 Update the mortar functors if the mesh has changed. More...
 
bool computedScalingJacobian () const
 
virtual void turnOffJacobian ()
 Turn off the Jacobian (must be called before equation system initialization) More...
 
bool computingPreSMOResidual ()
 Returns true if this system is currently computing the pre-SMO residual for a solve. More...
 
virtual void initialSetup () override
 Setup Functions. More...
 
virtual void timestepSetup () override
 
virtual void customSetup (const ExecFlagType &exec_type) override
 
virtual void residualSetup () override
 
virtual void jacobianSetup () override
 
bool haveFiniteDifferencedPreconditioner () const
 
bool haveFieldSplitPreconditioner () const
 
virtual void addHDGKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a hybridized discontinuous Galerkin (HDG) kernel. More...
 
virtual void addNodalKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a NodalKernel. More...
 
void addScalarKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a scalar kernel. More...
 
void addBoundaryCondition (const std::string &bc_name, const std::string &name, InputParameters &parameters)
 Adds a boundary condition. More...
 
virtual void addKokkosKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a Kokkos kernel. More...
 
virtual void addKokkosNodalKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a Kokkos nodal kernel. More...
 
void addKokkosBoundaryCondition (const std::string &bc_name, const std::string &name, InputParameters &parameters)
 Adds a Kokkos boundary condition. More...
 
void addConstraint (const std::string &c_name, const std::string &name, InputParameters &parameters)
 Adds a Constraint. More...
 
void addDiracKernel (const std::string &kernel_name, const std::string &name, InputParameters &parameters)
 Adds a Dirac kernel. More...
 
void addDGKernel (std::string dg_kernel_name, const std::string &name, InputParameters &parameters)
 Adds a DG kernel. More...
 
void addInterfaceKernel (std::string interface_kernel_name, const std::string &name, InputParameters &parameters)
 Adds an interface kernel. More...
 
void addDamper (const std::string &damper_name, const std::string &name, InputParameters &parameters)
 Adds a damper. More...
 
void addSplit (const std::string &split_name, const std::string &name, InputParameters &parameters)
 Adds a split. More...
 
std::shared_ptr< SplitgetSplit (const std::string &name)
 Retrieves a split by name. More...
 
MooseObjectWarehouseBase< Split > & getSplits ()
 Retrieves all splits. More...
 
bool shouldEvaluatePreSMOResidual () const
 We offer the option to check convergence against the pre-SMO residual. More...
 
void setPreSMOResidual (bool use)
 Set whether to evaluate the pre-SMO residual and use it in the subsequent relative convergence checks. More...
 
const bool & usePreSMOResidual () const
 Whether we are using pre-SMO residual in relative convergence checks. More...
 
Real referenceResidual () const
 The reference residual used in relative convergence check. More...
 
Real preSMOResidual () const
 The pre-SMO residual. More...
 
Real initialResidual () const
 The initial residual. More...
 
void setInitialResidual (Real r)
 Record the initial residual (for later relative convergence check) More...
 
void zeroVectorForResidual (const std::string &vector_name)
 
void setInitialSolution ()
 
void setKokkosInitialSolution ()
 
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 computeKokkosResidualAndJacobian (const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
 
void computeResidual (NumericVector< Number > &residual, TagID tag_id)
 Form a residual vector for a given tag. More...
 
void addImplicitGeometricCouplingEntries (GeometricSearchData &geom_search_data)
 Adds entries to the Jacobian in the correct positions for couplings coming from dofs being coupled that are related geometrically (i.e. More...
 
void constraintJacobians (const SparseMatrix< Number > &jacobian_to_view, bool displaced)
 Add jacobian contributions from Constraints. More...
 
void computeJacobianTags (const std::set< TagID > &tags)
 Computes multiple (tag associated) Jacobian matricese. More...
 
bool computeScaling ()
 Method used to obtain scaling factors for variables. More...
 
void computeJacobian (libMesh::SparseMatrix< Number > &jacobian, const std::set< TagID > &tags)
 Associate jacobian to systemMatrixTag, and then form a matrix for all the tags. More...
 
void computeJacobian (libMesh::SparseMatrix< Number > &jacobian)
 Take all tags in the system, and form a matrix for all tags in the system. More...
 
void computeJacobianBlocks (std::vector< JacobianBlock *> &blocks)
 Computes several Jacobian blocks simultaneously, summing their contributions into smaller preconditioning matrices. More...
 
void computeJacobianBlocks (std::vector< JacobianBlock *> &blocks, const std::set< TagID > &tags)
 
Real computeDamping (const NumericVector< Number > &solution, const NumericVector< Number > &update)
 Compute damping. More...
 
void onTimestepBegin ()
 Called at the beginning of the time step. More...
 
virtual void subdomainSetup (SubdomainID subdomain, THREAD_ID tid)
 Called from assembling when we hit a new subdomain. More...
 
virtual void subdomainSetup ()
 
virtual void subdomainSetup ()
 
void overwriteNodeFace (NumericVector< Number > &soln)
 Called from explicit time stepping to overwrite boundary positions (explicit dynamics). More...
 
void updateActive (THREAD_ID tid)
 Update active objects of Warehouses owned by NonlinearSystemBase. More...
 
virtual void setSolutionUDot (const NumericVector< Number > &udot)
 Set transient term used by residual and Jacobian evaluation. More...
 
virtual void setSolutionUDotDot (const NumericVector< Number > &udotdot)
 Set transient term used by residual and Jacobian evaluation. More...
 
NumericVector< Number > & getResidualTimeVector ()
 Return a numeric vector that is associated with the time tag. More...
 
NumericVector< Number > & getResidualNonTimeVector ()
 Return a numeric vector that is associated with the nontime tag. More...
 
NumericVector< Number > & residualVector (TagID tag)
 Return a residual vector that is associated with the residual tag. More...
 
virtual NumericVector< Number > & residualCopy () override
 
virtual NumericVector< Number > & residualGhosted () override
 
virtual void augmentSparsity (libMesh::SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz) override
 Will modify the sparsity pattern to add logical geometric connections. More...
 
void setPreconditioner (std::shared_ptr< MoosePreconditioner > pc)
 Sets a preconditioner. More...
 
MoosePreconditioner const * getPreconditioner () const
 
void useFiniteDifferencedPreconditioner (bool use=true)
 If called with true this system will use a finite differenced form of the Jacobian as the preconditioner. More...
 
void useFieldSplitPreconditioner (FieldSplitPreconditionerBase *fsp)
 If called with a non-null object true this system will use a field split preconditioner matrix. More...
 
FieldSplitPreconditionerBasegetFieldSplitPreconditioner ()
 
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...
 
virtual unsigned int nNonlinearIterations () const
 Return the number of non-linear iterations. More...
 
virtual 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...
 
virtual Real finalNonlinearResidual () const
 Return the final nonlinear residual. More...
 
Real nonlinearNorm () const
 Return the last nonlinear norm. More...
 
void printAllVariableNorms (bool state)
 Force the printing of all variable norms after each solve. More...
 
void debuggingResiduals (bool state)
 
void setPredictor (std::shared_ptr< Predictor > predictor)
 
PredictorgetPredictor ()
 
bool needBoundaryMaterialOnSide (BoundaryID bnd_id, THREAD_ID tid) const
 Indicated whether this system needs material properties on boundaries. More...
 
bool needInterfaceMaterialOnSide (BoundaryID bnd_id, THREAD_ID tid) const
 Indicated whether this system needs material properties on interfaces. More...
 
bool needInternalNeighborSideMaterial (SubdomainID subdomain_id, THREAD_ID tid) const
 Indicates whether this system needs material properties on internal sides. More...
 
bool doingDG () const
 Getter for _doing_dg. More...
 
bool hasSaveIn () const
 Weather or not the nonlinear system has save-ins. More...
 
bool hasDiagSaveIn () const
 Weather or not the nonlinear system has diagonal Jacobian save-ins. More...
 
virtual libMesh::Systemsystem () override
 Get the reference to the libMesh system. More...
 
virtual const libMesh::Systemsystem () const override
 
virtual void setSolutionUDotOld (const NumericVector< Number > &u_dot_old)
 
virtual void setSolutionUDotDotOld (const NumericVector< Number > &u_dotdot_old)
 
virtual void setPreviousNewtonSolution (const NumericVector< Number > &soln)
 
TagID timeVectorTag () const override
 Ideally, we should not need this API. More...
 
TagID nonTimeVectorTag () const override
 
TagID residualVectorTag () const override
 
TagID systemMatrixTag () const override
 Return the Matrix Tag ID for System. More...
 
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...
 
void destroyColoring ()
 Destroy the coloring object if it exists. More...
 
virtual void reinitNodeFace (const Node *node, BoundaryID bnd_id, THREAD_ID tid)
 Reinit nodal assembly info on a face. More...
 
virtual void reinitNodeFace (const Node *node, BoundaryID bnd_id, THREAD_ID tid)
 Reinit nodal assembly info on a face. More...
 
virtual void restoreSolutions () override final
 Restore current solutions (call after your solve failed) More...
 
void serializeSolution ()
 
void setSolution (const NumericVector< Number > &soln)
 Set the solution to a given vector. More...
 
void setFixedPointRelaxationFactor (const Real relaxation_factor)
 Enable solution under/over-relaxation for fixed point iterations. More...
 
void clearFixedPointRelaxation ()
 
void saveOldSolutionForFixedPointRelaxation ()
 
void applyFixedPointRelaxation ()
 
void setPCSide (MooseEnum pcs)
 Set the side on which the preconditioner is applied to. More...
 
Moose::PCSideType getPCSide ()
 Get the current preconditioner side. More...
 
void setMooseKSPNormType (MooseEnum kspnorm)
 Set the norm in which the linear convergence will be measured. More...
 
Moose::MooseKSPNormType getMooseKSPNormType ()
 Get the norm in which the linear convergence is measured. More...
 
virtual const NumericVector< Number > *const & currentSolution () const override final
 The solution vector that is currently being operated on. More...
 
virtual void compute (ExecFlagType type) override
 Compute time derivatives, auxiliary variables, etc. More...
 
unsigned int number () const
 Gets the number of this system. More...
 
MooseMeshmesh ()
 
const MooseMeshmesh () const
 
SubProblemsubproblem ()
 
const SubProblemsubproblem () const
 
FEProblemBasefeProblem ()
 
const FEProblemBasefeProblem () const
 
void applyScalingFactors (const std::vector< Real > &inverse_scaling_factors)
 Applies scaling factors to the system's variables. More...
 
bool computingScalingJacobian () const
 Whether we are computing an initial Jacobian for automatic variable scaling. More...
 
bool automaticScaling () const
 Getter for whether we are performing automatic scaling. More...
 
void automaticScaling (bool automatic_scaling)
 Setter for whether we are performing automatic scaling. More...
 
void setVerboseFlag (const bool &verbose)
 Sets the verbose flag. More...
 
virtual libMesh::DofMapdofMap ()
 Gets writeable reference to the dof map. More...
 
virtual const libMesh::DofMapdofMap () const
 Gets const reference to the dof map. More...
 
virtual void postInit ()
 
virtual void reinit ()
 Reinitialize the system when the degrees of freedom in this system have changed. More...
 
virtual void initializeObjects ()
 Called only once, just before the solve begins so objects can do some precalculations. More...
 
void update ()
 Update the system (doing libMesh magic) More...
 
virtual void copyOldSolutions ()
 Shifts the solutions backwards in time. More...
 
virtual void copyPreviousNonlinearSolutions ()
 Shifts the solutions backwards in nonlinear iteration history. More...
 
virtual void copyPreviousFixedPointSolutions ()
 
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...
 
libMesh::ParallelType solutionStateParallelType (const unsigned int state, const Moose::SolutionIterationType iteration_type) const
 Returns the parallel type of the given solution state. More...
 
virtual void needSolutionState (const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time, libMesh::ParallelType parallel_type=GHOSTED)
 Registers that the solution state state is needed. More...
 
virtual bool hasSolutionState (const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) const
 Whether or not the system has the solution state (0 = current, 1 = old, 2 = older, etc). More...
 
virtual void addDotVectors ()
 Add u_dot, u_dotdot, u_dot_old and u_dotdot_old vectors if requested by the time integrator. More...
 
virtual std::vector< Number > & duDotDus ()
 
virtual NumberduDotDotDu ()
 
virtual const NumberduDotDotDu () const
 
virtual const NumberduDotDu (unsigned int var_num=0) const
 
virtual NumericVector< Number > * solutionUDot ()
 
virtual const NumericVector< Number > * solutionUDot () const
 
virtual NumericVector< Number > * solutionUDotDot ()
 
virtual const NumericVector< Number > * solutionUDotDot () const
 
virtual NumericVector< Number > * solutionUDotOld ()
 
virtual const NumericVector< Number > * solutionUDotOld () const
 
virtual NumericVector< Number > * solutionUDotDotOld ()
 
virtual const NumericVector< Number > * solutionUDotDotOld () const
 
virtual void saveOldSolutions ()
 Save the old and older solutions. More...
 
virtual void restoreOldSolutions ()
 Restore the old and older solutions when the saved solutions present. More...
 
bool hasVector (const std::string &tag_name) const
 Check if the named vector exists in the system. More...
 
virtual bool hasVector (TagID tag_id) const
 Check if the tagged vector exists in the system. More...
 
virtual std::set< TagIDdefaultVectorTags () const
 Get the default vector tags associated with this system. More...
 
virtual std::set< TagIDdefaultMatrixTags () const
 Get the default matrix tags associted with this system. More...
 
virtual void associateVectorToTag (NumericVector< Number > &vec, TagID tag)
 Associate a vector for a given tag. More...
 
virtual void disassociateVectorFromTag (NumericVector< Number > &vec, TagID tag)
 Disassociate a given vector from a given tag. More...
 
virtual void disassociateVectorFromTag (TagID tag)
 Disassociate any vector that is associated with a given tag. More...
 
virtual void disassociateDefaultVectorTags ()
 Disassociate the vectors associated with the default vector tags of this system. More...
 
virtual bool hasMatrix (TagID tag) const
 Check if the tagged matrix exists in the system. More...
 
virtual libMesh::SparseMatrix< Number > & getMatrix (TagID tag)
 Get a raw SparseMatrix. More...
 
virtual const libMesh::SparseMatrix< Number > & getMatrix (TagID tag) const
 Get a raw SparseMatrix. More...
 
virtual void activateAllMatrixTags ()
 Make all existing matrices active. More...
 
virtual bool matrixTagActive (TagID tag) const
 If or not a matrix tag is active. More...
 
virtual void deactivateAllMatrixTags ()
 Make matrices inactive. More...
 
void closeTaggedMatrices (const std::set< TagID > &tags)
 Close all matrices associated the tags. More...
 
void flushTaggedMatrices (const std::set< TagID > &tags)
 flushes all matrices associated to tags. More...
 
virtual void associateMatrixToTag (libMesh::SparseMatrix< Number > &matrix, TagID tag)
 Associate a matrix to a tag. More...
 
virtual void disassociateMatrixFromTag (libMesh::SparseMatrix< Number > &matrix, TagID tag)
 Disassociate a matrix from a tag. More...
 
virtual void disassociateMatrixFromTag (TagID tag)
 Disassociate any matrix that is associated with a given tag. More...
 
virtual void disassociateDefaultMatrixTags ()
 Disassociate the matrices associated with the default matrix tags of this system. More...
 
virtual NumericVector< Number > & serializedSolution ()
 Returns a reference to a serialized version of the solution vector for this subproblem. More...
 
virtual void augmentSendList (std::vector< dof_id_type > &send_list)
 Will modify the send_list to add all of the extra ghosted dofs for this system. More...
 
virtual void addVariable (const std::string &var_type, const std::string &var_name, InputParameters &parameters)
 Canonical method for adding a variable. More...
 
virtual bool isArrayVariable (const std::string &var_name) const
 If a variable is an array variable. More...
 
virtual bool isScalarVariable (unsigned int var_name) const
 
MooseVariableFieldBasegetVariable (THREAD_ID tid, const std::string &var_name) const
 Gets a reference to a variable of with specified name. More...
 
MooseVariableFieldBasegetVariable (THREAD_ID tid, unsigned int var_number) const
 Gets a reference to a variable with specified number. More...
 
template<typename T >
MooseVariableFE< T > & getFieldVariable (THREAD_ID tid, const std::string &var_name)
 Gets a reference to a variable of with specified name. More...
 
template<typename T >
MooseVariableFE< T > & getFieldVariable (THREAD_ID tid, unsigned int var_number)
 Gets a reference to a variable with specified number. More...
 
template<typename T >
MooseVariableField< T > & getActualFieldVariable (THREAD_ID tid, const std::string &var_name)
 Returns a field variable pointer - this includes finite volume variables. More...
 
template<typename T >
MooseVariableField< T > & getActualFieldVariable (THREAD_ID tid, unsigned int var_number)
 Returns a field variable pointer - this includes finite volume variables. More...
 
template<typename T >
MooseVariableFV< T > & getFVVariable (THREAD_ID tid, const std::string &var_name)
 Return a finite volume variable. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, const std::string &var_name) const
 Gets a reference to a scalar variable with specified number. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, unsigned int var_number) const
 Gets a reference to a variable with specified number. More...
 
virtual const std::set< SubdomainID > * getVariableBlocks (unsigned int var_number)
 Get the block where a variable of this system is defined. More...
 
virtual unsigned int nVariables () const
 Get the number of variables in this system. More...
 
unsigned int nFieldVariables () const
 Get the number of field variables in this system. More...
 
unsigned int nFVVariables () const
 Get the number of finite volume variables in this system. More...
 
std::size_t getMaxVarNDofsPerElem () const
 Gets the maximum number of dofs used by any one variable on any one element. More...
 
std::size_t getMaxVarNDofsPerNode () const
 Gets the maximum number of dofs used by any one variable on any one node. More...
 
void assignMaxVarNDofsPerElem (std::size_t max_dofs)
 assign the maximum element dofs More...
 
void assignMaxVarNDofsPerNode (std::size_t max_dofs)
 assign the maximum node dofs More...
 
virtual void addVariableToZeroOnResidual (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each residual evaluation. More...
 
virtual void addVariableToZeroOnJacobian (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each Jacobian evaluation. More...
 
virtual void zeroVariables (std::vector< std::string > &vars_to_be_zeroed)
 Zero out the solution for the list of variables passed in. More...
 
virtual void zeroVariablesForResidual ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on residual evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual void zeroVariablesForJacobian ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on Jacobian evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual libMesh::Order getMinQuadratureOrder ()
 Get minimal quadrature order needed for integrating variables in this system. More...
 
virtual void prepare (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareFace (THREAD_ID tid, bool resize_data)
 Prepare the system for use on sides. More...
 
virtual void prepareNeighbor (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareLowerD (THREAD_ID tid)
 Prepare the system for use for lower dimensional elements. More...
 
virtual void reinitElem (const Elem *elem, THREAD_ID tid)
 Reinit an element assembly info. More...
 
virtual void reinitElemFace (const Elem *elem, unsigned int side, THREAD_ID tid)
 Reinit assembly info for a side of an element. More...
 
virtual void reinitNeighborFace (const Elem *elem, unsigned int side, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitNeighbor (const Elem *elem, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitLowerD (THREAD_ID tid)
 Compute the values of the variables on the lower dimensional element. More...
 
virtual void reinitNode (const Node *node, THREAD_ID tid)
 Reinit nodal assembly info. More...
 
virtual void 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 VariableWarehousevariableWarehouse (THREAD_ID tid=0) const
 
const std::vector< MooseVariableScalar * > & getScalarVariables (THREAD_ID tid)
 
const std::set< SubdomainID > & getSubdomainsForVar (unsigned int var_number) const
 
const std::set< SubdomainID > & getSubdomainsForVar (const std::string &var_name) const
 Get the block where a variable of this system is defined. More...
 
void removeVector (const std::string &name)
 Remove a vector from the system with the given name. More...
 
void removeVector (TagID tag_id)
 Remove a solution length vector from the system with the specified TagID. More...
 
NumericVector< Number > & addVector (const std::string &vector_name, const bool project, const libMesh::ParallelType type)
 Adds a solution length vector to the system. More...
 
NumericVector< Number > & addVector (TagID tag, const bool project, const libMesh::ParallelType type)
 Adds a solution length vector to the system with the specified TagID. More...
 
void closeTaggedVector (const TagID tag)
 Close vector with the given tag. More...
 
void closeTaggedVectors (const std::set< TagID > &tags)
 Close all vectors for given tags. More...
 
void zeroTaggedVector (const TagID tag)
 Zero vector with the given tag. More...
 
void zeroTaggedVectors (const std::set< TagID > &tags)
 Zero all vectors for given tags. More...
 
void setVariableGlobalDoFs (const std::string &var_name)
 set all the global dof indices for a variable More...
 
const std::vector< dof_id_type > & getVariableGlobalDoFs ()
 Get the global dof indices of a variable, this needs to be called after the indices have been set by setVariableGlobalDoFs More...
 
libMesh::SparseMatrix< Number > & addMatrix (TagID tag)
 Adds a matrix with a given tag. More...
 
void removeMatrix (TagID tag)
 Removes a matrix with a given tag. More...
 
virtual const std::string & name () const
 
const std::vector< VariableName > & getVariableNames () const
 
void getStandardFieldVariableNames (std::vector< VariableName > &std_field_variables) const
 
unsigned int getMaxVariableNumber () const
 Returns the maximum number of all variables on the system. More...
 
virtual void computeVariables (const NumericVector< Number > &)
 
void copyVars (libMesh::ExodusII_IO &io)
 
virtual void copySolutionsBackwards ()
 Copy current solution into old and older. More...
 
void addTimeIntegrator (const std::string &type, const std::string &name, InputParameters &parameters)
 
bool hasVarCopy () const
 Whether or not there are variables to be restarted from an Exodus mesh file. More...
 
void addScalingVector ()
 Add the scaling factor vector to the system. More...
 
bool solutionStatesInitialized () const
 Whether or not the solution states have been initialized via initSolutionState() More...
 
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
 
void copyTimeIntegrators (const SystemBase &other_sys)
 Copy time integrators from another system. More...
 
const TimeIntegratorgetTimeIntegrator (const unsigned int var_num) const
 Retrieve the time integrator that integrates the given variable's equation. More...
 
const TimeIntegratorqueryTimeIntegrator (const unsigned int var_num) const
 Retrieve the time integrator that integrates the given variable's equation. More...
 
const std::vector< std::shared_ptr< TimeIntegrator > > & getTimeIntegrators ()
 
std::string prefix () const
 
void sizeVariableMatrixData ()
 size the matrix data for each variable for the number of matrix tags we have More...
 
void skipNextSolutionToOldCopy ()
 Skip the next copy from the solution vector to the old solution vector old -> older is still performed. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
PerfGraphperfGraph ()
 Get the PerfGraph. More...
 
void checkKernelCoverage (const std::set< SubdomainID > &mesh_subdomains) const
 
virtual bool containsTimeKernel () override
 If the system has a kernel that corresponds to a time derivative. More...
 
virtual std::vector< std::string > timeKernelVariableNames () override
 Returns the names of the variables that have time derivative kernels in the system. More...
 
MooseObjectTagWarehouse< KernelBase > & getKernelWarehouse ()
 Access functions to Warehouses from outside NonlinearSystemBase. More...
 
const MooseObjectTagWarehouse< KernelBase > & getKernelWarehouse () const
 
MooseObjectTagWarehouse< DGKernelBase > & getDGKernelWarehouse ()
 
MooseObjectTagWarehouse< InterfaceKernelBase > & getInterfaceKernelWarehouse ()
 
MooseObjectTagWarehouse< DiracKernelBase > & getDiracKernelWarehouse ()
 
MooseObjectTagWarehouse< IntegratedBCBase > & getIntegratedBCWarehouse ()
 
const MooseObjectTagWarehouse< IntegratedBCBase > & getIntegratedBCWarehouse () const
 Return the IntegratedBCBase warehouse. More...
 
const MooseObjectTagWarehouse< ScalarKernelBase > & getScalarKernelWarehouse () const
 
const MooseObjectTagWarehouse< NodalKernelBase > & getNodalKernelWarehouse () const
 
MooseObjectTagWarehouse< HDGKernel > & getHDGKernelWarehouse ()
 
const MooseObjectWarehouse< ElementDamper > & getElementDamperWarehouse () const
 
const MooseObjectWarehouse< NodalDamper > & getNodalDamperWarehouse () const
 
const ConstraintWarehousegetConstraintWarehouse () const
 
const MooseObjectTagWarehouse< NodalBCBase > & getNodalBCWarehouse () const
 Return the NodalBCBase warehouse. More...
 
MooseObjectTagWarehouse< ResidualObject > & getKokkosKernelWarehouse ()
 
MooseObjectTagWarehouse< ResidualObject > & getKokkosNodalKernelWarehouse ()
 
MooseObjectTagWarehouse< ResidualObject > & getKokkosNodalBCWarehouse ()
 
MooseObjectTagWarehouse< ResidualObject > & getKokkosIntegratedBCWarehouse ()
 
virtual NumericVector< Number > & getVector (const std::string &name)
 Get a raw NumericVector by name. More...
 
virtual const NumericVector< Number > & getVector (const std::string &name) const
 
virtual NumericVector< Number > & getVector (TagID tag)
 Get a raw NumericVector by tag. More...
 
virtual const NumericVector< Number > & getVector (TagID tag) const
 
virtual bool hasVariable (const std::string &var_name) const
 Query a system for a variable. More...
 
virtual bool hasScalarVariable (const std::string &var_name) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Public Attributes

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

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Definition at line 19 of file MooseEigenSystem.h.

Member Enumeration Documentation

◆ SYSTEMTAG

System or kernel tags.

Enumerator
ALL 
EIGEN 

Definition at line 44 of file MooseEigenSystem.h.

Constructor & Destructor Documentation

◆ MooseEigenSystem()

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

Definition at line 17 of file MooseEigenSystem.C.

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

◆ ~MooseEigenSystem()

MooseEigenSystem::~MooseEigenSystem ( )
virtual

Definition at line 25 of file MooseEigenSystem.C.

25 {}

Member Function Documentation

◆ activateAllMatrixTags()

void SystemBase::activateAllMatrixTags ( )
virtualinherited

Make all existing matrices active.

Definition at line 1132 of file SystemBase.C.

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

1133 {
1134  auto num_matrix_tags = _subproblem.numMatrixTags();
1135 
1136  _matrix_tag_active_flags.resize(num_matrix_tags);
1137  _active_tagged_matrices.clear();
1138 
1139  for (const auto tag : make_range(num_matrix_tags))
1140  if (hasMatrix(tag))
1141  {
1142  _matrix_tag_active_flags[tag] = true;
1143  _active_tagged_matrices.emplace(tag, &getMatrix(tag));
1144  }
1145  else
1146  _matrix_tag_active_flags[tag] = false;
1147 }
std::unordered_map< TagID, libMesh::SparseMatrix< Number > * > _active_tagged_matrices
Active tagged matrices. A matrix is active if its tag-matrix pair is present in the map...
Definition: SystemBase.h:1025
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:361
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:1027
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:248
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025
IntRange< T > make_range(T beg, T end)

◆ activeOnOld()

bool MooseEigenSystem::activeOnOld ( )

Return if eigen kernels should be on old solution.

Definition at line 221 of file MooseEigenSystem.C.

Referenced by EigenKernel::enabled().

222 {
223  return _active_on_old;
224 }

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

549 {
550  // ThreadID
551  THREAD_ID tid = 0;
552 
553  // Create the object
554  std::shared_ptr<BoundaryCondition> bc =
555  _factory.create<BoundaryCondition>(bc_name, name, parameters, tid);
557 
558  // Active BoundaryIDs for the object
559  const std::set<BoundaryID> & boundary_ids = bc->boundaryIDs();
560  auto bc_var = dynamic_cast<const MooseVariableFieldBase *>(&bc->variable());
561  _vars[tid].addBoundaryVar(boundary_ids, bc_var);
562 
563  // Cast to the various types of BCs
564  std::shared_ptr<NodalBCBase> nbc = std::dynamic_pointer_cast<NodalBCBase>(bc);
565  std::shared_ptr<IntegratedBCBase> ibc = std::dynamic_pointer_cast<IntegratedBCBase>(bc);
566 
567  // NodalBCBase
568  if (nbc)
569  {
570  if (nbc->checkNodalVar() && !nbc->variable().isNodal())
571  mooseError("Trying to use nodal boundary condition '",
572  nbc->name(),
573  "' on a non-nodal variable '",
574  nbc->variable().name(),
575  "'.");
576 
577  _nodal_bcs.addObject(nbc);
578  // Add to theWarehouse, a centralized storage for all moose objects
580  _vars[tid].addBoundaryVars(boundary_ids, nbc->getCoupledVars());
581 
582  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
583  _has_nodalbc_save_in = true;
584  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
586 
587  // DirichletBCs that are preset
588  std::shared_ptr<DirichletBCBase> dbc = std::dynamic_pointer_cast<DirichletBCBase>(bc);
589  if (dbc && dbc->preset())
591 
592  std::shared_ptr<ADDirichletBCBase> addbc = std::dynamic_pointer_cast<ADDirichletBCBase>(bc);
593  if (addbc && addbc->preset())
595  }
596 
597  // IntegratedBCBase
598  else if (ibc)
599  {
600  _integrated_bcs.addObject(ibc, tid);
601  // Add to theWarehouse, a centralized storage for all moose objects
603  _vars[tid].addBoundaryVars(boundary_ids, ibc->getCoupledVars());
604 
605  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
606  _has_save_in = true;
607  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
608  _has_diag_save_in = true;
609 
610  for (tid = 1; tid < libMesh::n_threads(); tid++)
611  {
612  // Create the object
613  bc = _factory.create<BoundaryCondition>(bc_name, name, parameters, tid);
614 
615  // Give users opportunity to set some parameters
617 
618  // Active BoundaryIDs for the object
619  const std::set<BoundaryID> & boundary_ids = bc->boundaryIDs();
620  _vars[tid].addBoundaryVar(boundary_ids, bc_var);
621 
622  ibc = std::static_pointer_cast<IntegratedBCBase>(bc);
623 
624  _integrated_bcs.addObject(ibc, tid);
625  _vars[tid].addBoundaryVars(boundary_ids, ibc->getCoupledVars());
626  }
627  }
628 
629  else
630  mooseError("Unknown BoundaryCondition type for object named ", bc->name());
631 }
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:311
bool _has_nodalbc_diag_save_in
If there is a nodal BC having diag_save_in.
Base class for automatic differentiation Dirichlet BCs.
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Base boundary condition of a Dirichlet type.
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
Factory & _factory
Definition: SystemBase.h:989
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:1342
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
Base class for deriving any boundary condition that works at nodes.
Definition: NodalBCBase.h:26
Base class for creating new types of boundary conditions.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
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:237
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 634 of file NonlinearSystemBase.C.

637 {
638  std::shared_ptr<Constraint> constraint = _factory.create<Constraint>(c_name, name, parameters);
639  _constraints.addObject(constraint);
640  postAddResidualObject(*constraint);
641 
643  if (constraint && constraint->addCouplingEntriesToJacobian())
645 }
bool useHashTableMatrixAssembly() const
void addImplicitGeometricCouplingEntriesToJacobian(bool add=true)
If called with true this will add entries into the jacobian to link together degrees of freedom that ...
Base class for all Constraint types.
Definition: Constraint.h:19
Factory & _factory
Definition: SystemBase.h:989
virtual const std::string & name() const
Definition: SystemBase.C:1342
virtual std::unique_ptr< Base > create()=0
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
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 708 of file NonlinearSystemBase.C.

711 {
712  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
713  {
714  std::shared_ptr<Damper> damper = _factory.create<Damper>(damper_name, name, parameters, tid);
715 
716  // Attempt to cast to the damper types
717  std::shared_ptr<ElementDamper> ed = std::dynamic_pointer_cast<ElementDamper>(damper);
718  std::shared_ptr<NodalDamper> nd = std::dynamic_pointer_cast<NodalDamper>(damper);
719  std::shared_ptr<GeneralDamper> gd = std::dynamic_pointer_cast<GeneralDamper>(damper);
720 
721  if (gd)
722  {
724  break; // not threaded
725  }
726  else if (ed)
727  _element_dampers.addObject(ed, tid);
728  else if (nd)
729  _nodal_dampers.addObject(nd, tid);
730  else
731  mooseError("Invalid damper type");
732  }
733 }
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:311
Factory & _factory
Definition: SystemBase.h:989
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:1342
virtual std::unique_ptr< Base > create()=0
Base class for deriving nodal dampers.
Definition: NodalDamper.h:27
Base class for deriving element dampers.
Definition: ElementDamper.h:33
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
Base class for deriving dampers.
Definition: Damper.h:24
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true) override
Adds an object to the storage structure.
unsigned int THREAD_ID
Definition: MooseTypes.h:237

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

667 {
668  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
669  {
670  auto dg_kernel = _factory.create<DGKernelBase>(dg_kernel_name, name, parameters, tid);
671  _dg_kernels.addObject(dg_kernel, tid);
672  // Add to theWarehouse, a centralized storage for all moose objects
673  _fe_problem.theWarehouse().add(dg_kernel);
674  postAddResidualObject(*dg_kernel);
675  }
676 
677  _doing_dg = true;
678 
679  if (parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
680  _has_save_in = true;
681  if (parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
682  _has_diag_save_in = true;
683 }
unsigned int n_threads()
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:989
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:1342
bool _doing_dg
true if DG is active (optimization reasons)
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
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:237

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

651 {
652  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
653  {
654  std::shared_ptr<DiracKernelBase> kernel =
655  _factory.create<DiracKernelBase>(kernel_name, name, parameters, tid);
656  postAddResidualObject(*kernel);
657  _dirac_kernels.addObject(kernel, tid);
658  // Add to theWarehouse, a centralized storage for all moose objects
659  _fe_problem.theWarehouse().add(kernel);
660  }
661 }
unsigned int n_threads()
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:989
virtual const std::string & name() const
Definition: SystemBase.C:1342
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
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:237

◆ addDotVectors()

void SystemBase::addDotVectors ( )
virtualinherited

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

Reimplemented in DisplacedSystem.

Definition at line 1622 of file SystemBase.C.

Referenced by DisplacedSystem::addDotVectors().

1623 {
1624  if (_fe_problem.uDotRequested())
1625  _u_dot = &addVector("u_dot", true, GHOSTED);
1627  _u_dot_old = &addVector("u_dot_old", true, GHOSTED);
1629  _u_dotdot = &addVector("u_dotdot", true, GHOSTED);
1631  _u_dotdot_old = &addVector("u_dotdot_old", true, GHOSTED);
1632 }
virtual bool uDotDotOldRequested()
Get boolean flag to check whether old solution second time derivative needs to be stored...
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
Definition: SystemBase.h:1011
virtual bool uDotRequested()
Get boolean flag to check whether solution time derivative needs to be stored.
virtual bool uDotDotRequested()
Get boolean flag to check whether solution second time derivative needs to be stored.
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot
Definition: SystemBase.h:1008
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
virtual bool uDotOldRequested()
Get boolean flag to check whether old solution time derivative needs to be stored.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
NumericVector< Number > * _u_dot
solution vector for u^dot
Definition: SystemBase.h:1006
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
Definition: SystemBase.h:1013

◆ addHDGKernel()

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

Adds a hybridized discontinuous Galerkin (HDG) kernel.

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

Definition at line 492 of file NonlinearSystemBase.C.

495 {
496  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
497  {
498  // Create the kernel object via the factory and add to warehouse
499  auto kernel = _factory.create<HDGKernel>(kernel_name, name, parameters, tid);
500  _kernels.addObject(kernel, tid);
501  _hybridized_kernels.addObject(kernel, tid);
502  // Add to theWarehouse, a centralized storage for all moose objects
503  _fe_problem.theWarehouse().add(kernel);
504  postAddResidualObject(*kernel);
505  }
506 }
A kernel for hybridized finite element formulations.
Definition: HDGKernel.h:17
unsigned int n_threads()
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:989
virtual const std::string & name() const
Definition: SystemBase.C:1342
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
MooseObjectTagWarehouse< KernelBase > _kernels
MooseObjectTagWarehouse< HDGKernel > _hybridized_kernels
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
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:237

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

Referenced by NonlinearSystemBase::computeJacobianInternal().

2470 {
2471  if (!hasMatrix(systemMatrixTag()))
2472  mooseError("Need a system matrix ");
2473 
2474  // At this point, have no idea how to make
2475  // this work with tag system
2476  auto & jacobian = getMatrix(systemMatrixTag());
2477 
2478  std::unordered_map<dof_id_type, std::vector<dof_id_type>> graph;
2479 
2480  findImplicitGeometricCouplingEntries(geom_search_data, graph);
2481 
2482  for (const auto & it : graph)
2483  {
2484  dof_id_type dof = it.first;
2485  const auto & row = it.second;
2486 
2487  for (const auto & coupled_dof : row)
2488  jacobian.add(dof, coupled_dof, 0);
2489  }
2490 }
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:311
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:361
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025
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 515 of file NonlinearSystemBase.h.

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

516  {
518  }
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 686 of file NonlinearSystemBase.C.

689 {
690  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
691  {
692  std::shared_ptr<InterfaceKernelBase> interface_kernel =
693  _factory.create<InterfaceKernelBase>(interface_kernel_name, name, parameters, tid);
694  postAddResidualObject(*interface_kernel);
695 
696  const std::set<BoundaryID> & boundary_ids = interface_kernel->boundaryIDs();
697  auto ik_var = dynamic_cast<const MooseVariableFieldBase *>(&interface_kernel->variable());
698  _vars[tid].addBoundaryVar(boundary_ids, ik_var);
699 
700  _interface_kernels.addObject(interface_kernel, tid);
701  // Add to theWarehouse, a centralized storage for all moose objects
702  _fe_problem.theWarehouse().add(interface_kernel);
703  _vars[tid].addBoundaryVars(boundary_ids, interface_kernel->getCoupledVars());
704  }
705 }
unsigned int n_threads()
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:989
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:1342
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
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:237

◆ addKernel()

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

Adds a kernel.

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

Reimplemented from NonlinearSystemBase.

Definition at line 28 of file MooseEigenSystem.C.

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

◆ addKokkosBoundaryCondition()

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

Adds a Kokkos boundary condition.

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

◆ addKokkosKernel()

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

Adds a Kokkos kernel.

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

◆ addKokkosNodalKernel()

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

Adds a Kokkos nodal kernel.

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

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

572 {
573  if (!_subproblem.matrixTagExists(tag))
574  mooseError("Cannot add tagged matrix with TagID ",
575  tag,
576  " in system '",
577  name(),
578  "' because the tag does not exist in the problem");
579 
580  if (hasMatrix(tag))
581  return getMatrix(tag);
582 
583  const auto matrix_name = _subproblem.matrixTagName(tag);
584  SparseMatrix<Number> & mat = system().add_matrix(matrix_name);
585  associateMatrixToTag(mat, tag);
586 
587  return mat;
588 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:361
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
Definition: SystemBase.C:1077
virtual const std::string & name() const
Definition: SystemBase.C:1342
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025
SparseMatrix< Number > & add_matrix(std::string_view mat_name, ParallelType type=PARALLEL, MatrixBuildType mat_build_type=MatrixBuildType::AUTOMATIC)
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:329
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:358

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

512 {
513  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
514  {
515  // Create the kernel object via the factory and add to the warehouse
516  std::shared_ptr<NodalKernelBase> kernel =
517  _factory.create<NodalKernelBase>(kernel_name, name, parameters, tid);
518  _nodal_kernels.addObject(kernel, tid);
519  // Add to theWarehouse, a centralized storage for all moose objects
520  _fe_problem.theWarehouse().add(kernel);
521  postAddResidualObject(*kernel);
522  }
523 
524  if (parameters.have_parameter<std::vector<AuxVariableName>>("save_in") &&
525  parameters.get<std::vector<AuxVariableName>>("save_in").size() > 0)
526  _has_save_in = true;
527  if (parameters.have_parameter<std::vector<AuxVariableName>>("save_in") &&
528  parameters.get<std::vector<AuxVariableName>>("diag_save_in").size() > 0)
529  _has_diag_save_in = true;
530 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
unsigned int n_threads()
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:989
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
virtual const std::string & name() const
Definition: SystemBase.C:1342
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
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:237

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

536 {
537  std::shared_ptr<ScalarKernelBase> kernel =
538  _factory.create<ScalarKernelBase>(kernel_name, name, parameters);
539  postAddResidualObject(*kernel);
540  // Add to theWarehouse, a centralized storage for all moose objects
541  _fe_problem.theWarehouse().add(kernel);
542  _scalar_kernels.addObject(kernel);
543 }
void add(std::shared_ptr< MooseObject > obj)
add adds a new object to the warehouse and stores attributes/metadata about it for running queries/fi...
Definition: TheWarehouse.C:116
Factory & _factory
Definition: SystemBase.h:989
virtual const std::string & name() const
Definition: SystemBase.C:1342
virtual std::unique_ptr< Base > create()=0
TheWarehouse & theWarehouse() const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
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 1547 of file SystemBase.C.

Referenced by MooseVariableBase::initialSetup().

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

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

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

◆ addTimeIntegrator()

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

Definition at line 1647 of file SystemBase.C.

1650 {
1651  parameters.set<SystemBase *>("_sys") = this;
1652  _time_integrators.push_back(_factory.create<TimeIntegrator>(type, name, parameters));
1653 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Factory & _factory
Definition: SystemBase.h:989
Base class for a system (of equations)
Definition: SystemBase.h:85
virtual const std::string & name() const
Definition: SystemBase.C:1342
virtual std::unique_ptr< Base > create()=0
Base class for time integrators.

◆ addVariable()

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

Canonical method for adding a variable.

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

Reimplemented in AuxiliarySystem.

Definition at line 719 of file SystemBase.C.

Referenced by AuxiliarySystem::addVariable().

722 {
724 
725  const auto components = parameters.get<unsigned int>("components");
726 
727  // Convert the std::vector parameter provided by the user into a std::set for use by libMesh's
728  // System::add_variable method
729  std::set<SubdomainID> blocks;
730  const auto & block_param = parameters.get<std::vector<SubdomainName>>("block");
731  for (const auto & subdomain_name : block_param)
732  {
733  SubdomainID blk_id = _mesh.getSubdomainID(subdomain_name);
734  blocks.insert(blk_id);
735  }
736 
737  const auto fe_type =
738  FEType(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")),
739  Utility::string_to_enum<FEFamily>(parameters.get<MooseEnum>("family")));
740  const auto fe_field_type = FEInterface::field_type(fe_type);
741 
742  unsigned int var_num;
743 
744  if (var_type == "ArrayMooseVariable")
745  {
746  if (fe_field_type == TYPE_VECTOR)
747  mooseError("Vector family type cannot be used in an array variable");
748 
749  std::vector<std::string> array_var_component_names;
750  const bool has_array_names = parameters.isParamValid("array_var_component_names");
751  if (has_array_names)
752  {
753  array_var_component_names =
754  parameters.get<std::vector<std::string>>("array_var_component_names");
755  if (array_var_component_names.size() != components)
756  parameters.paramError("array_var_component_names",
757  "Must be the same size as 'components' (size ",
758  components,
759  ") for array variable '",
760  name,
761  "'");
762  }
763 
764  // Build up the variable names
765  std::vector<std::string> var_names;
766  for (unsigned int i = 0; i < components; i++)
767  {
768  if (!has_array_names)
769  array_var_component_names.push_back(std::to_string(i));
770  var_names.push_back(name + "_" + array_var_component_names[i]);
771  }
772 
773  // makes sure there is always a name, either the provided one or '1 2 3 ...'
774  parameters.set<std::vector<std::string>>("array_var_component_names") =
775  array_var_component_names;
776 
777  // The number returned by libMesh is the _last_ variable number... we want to hold onto the
778  // _first_
779  var_num = system().add_variable_array(var_names, fe_type, &blocks) - (components - 1);
780 
781  // Set as array variable
782  if (parameters.isParamSetByUser("array") && !parameters.get<bool>("array"))
783  parameters.paramError("array",
784  "Must be set to true for variable '",
785  name,
786  "' because 'components' > 1 (is an array variable)");
787  parameters.set<bool>("array") = true;
788  }
789  else
790  {
791  if (parameters.isParamSetByUser("array_var_component_names"))
792  parameters.paramError("array_var_component_names",
793  "Should not be set because this variable (",
794  name,
795  ") is a non-array variable");
796  var_num = system().add_variable(name, fe_type, &blocks);
797  }
798 
799  parameters.set<unsigned int>("_var_num") = var_num;
800  parameters.set<SystemBase *>("_system_base") = this;
801 
802  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
803  {
804  parameters.set<THREAD_ID>("tid") = tid;
805  std::shared_ptr<MooseVariableBase> var =
806  _factory.create<MooseVariableBase>(var_type, name, parameters, tid);
807 
808  _vars[tid].add(name, var);
809 
810  if (auto fe_var = dynamic_cast<MooseVariableFieldBase *>(var.get()))
811  {
812  auto required_size = var_num + components;
813  if (required_size > _numbered_vars[tid].size())
814  _numbered_vars[tid].resize(required_size);
815  for (MooseIndex(components) component = 0; component < components; ++component)
816  _numbered_vars[tid][var_num + component] = fe_var;
817 
818  if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADReal> *>(fe_var))
819  _subproblem.addFunctor(name, *functor, tid);
820  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADRealVectorValue> *>(fe_var))
821  _subproblem.addFunctor(name, *functor, tid);
822  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADRealEigenVector> *>(fe_var))
823  _subproblem.addFunctor(name, *functor, tid);
824  else
825  mooseError("This should be a functor");
826  }
827 
828  if (auto scalar_var = dynamic_cast<MooseVariableScalar *>(var.get()))
829  {
830  if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADReal> *>(scalar_var))
831  _subproblem.addFunctor(name, *functor, tid);
832  else
833  mooseError("Scalar variables should be functors");
834  }
835 
836  if (var->blockRestricted())
837  for (const SubdomainID & id : var->blockIDs())
838  for (MooseIndex(components) component = 0; component < components; ++component)
839  _var_map[var_num + component].insert(id);
840  else
841  for (MooseIndex(components) component = 0; component < components; ++component)
842  _var_map[var_num + component] = std::set<SubdomainID>();
843  }
844 
845  // getMaxVariableNumber is an API method used in Rattlesnake
846  if (var_num > _max_var_number)
847  _max_var_number = var_num;
848  _du_dot_du.resize(var_num + 1);
849 }
std::vector< std::vector< MooseVariableFieldBase * > > _numbered_vars
Map variable number to its pointer.
Definition: SystemBase.h:1052
std::vector< Real > _du_dot_du
Derivative of time derivative of u with respect to uj.
Definition: SystemBase.h:1017
unsigned int n_threads()
char ** blocks
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
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.
unsigned int add_variable_array(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
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:1385
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
Factory & _factory
Definition: SystemBase.h:989
Base class for a system (of equations)
Definition: SystemBase.h:85
virtual const std::string & name() const
Definition: SystemBase.C:1342
void paramError(const std::string &param, Args... args) const
Emits a parameter error prefixed with the parameter location and object information if available...
virtual std::unique_ptr< Base > create()=0
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:998
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was set by the user.
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
MooseMesh & _mesh
Definition: SystemBase.h:991
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:1000
Base variable class.
unsigned int THREAD_ID
Definition: MooseTypes.h:237
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
Definition: MooseMesh.C:1753
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.

◆ addVariableToCopy()

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

Add info about variable that will be copied.

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

Definition at line 1176 of file SystemBase.C.

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

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

◆ addVariableToZeroOnJacobian()

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

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

Parameters
var_nameThe name of the variable to be zeroed.

Reimplemented in DisplacedSystem.

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

182 {
183  _vars_to_be_zeroed_on_jacobian.push_back(var_name);
184 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:1003

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

176 {
177  _vars_to_be_zeroed_on_residual.push_back(var_name);
178 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:1002

◆ addVector() [1/2]

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

Adds a solution length vector to the system.

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

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

◆ addVector() [2/2]

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

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

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

◆ applyFixedPointRelaxation()

void SolverSystem::applyFixedPointRelaxation ( )
inherited

Definition at line 109 of file SolverSystem.C.

110 {
111  if (MooseUtils::absoluteFuzzyEqual(_fixed_point_relaxation_factor, 1.0))
112  return;
113 
115  "Fixed point relaxation was requested but the old fixed point solution was not "
116  "saved.");
117 
118  // This might be paranoid but who knows, maybe someone requests nonghosted
120  solution().type(),
121  "Fixed point relaxation requires the previous fixed point solution state to have "
122  "the same parallel type as the system solution.");
123 
124  auto & sol = solution();
126  sol.add(1.0 - _fixed_point_relaxation_factor,
128  sol.close();
129  update();
130 }
NumericVector< Number > & solution()
Definition: SystemBase.h:197
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:1433
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1244
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:1087
Real _fixed_point_relaxation_factor
Used for relaxing entire system solution during fixed point (multi-)system iterations.
Definition: SolverSystem.h:131
libMesh::ParallelType solutionStateParallelType(const unsigned int state, const Moose::SolutionIterationType iteration_type) const
Returns the parallel type of the given solution state.
Definition: SystemBase.C:1442

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

Referenced by NonlinearSystemBase::computeScaling().

1498 {
1499  for (MooseIndex(_vars) thread = 0; thread < _vars.size(); ++thread)
1500  {
1501  auto & field_variables = _vars[thread].fieldVariables();
1502  for (MooseIndex(field_variables) i = 0, p = 0; i < field_variables.size(); ++i)
1503  {
1504  auto factors = field_variables[i]->arrayScalingFactor();
1505  for (unsigned int j = 0; j < field_variables[i]->count(); ++j, ++p)
1506  factors[j] /= inverse_scaling_factors[p];
1507 
1508  field_variables[i]->scalingFactor(factors);
1509  }
1510 
1511  auto offset = field_variables.size();
1512 
1513  auto & scalar_variables = _vars[thread].scalars();
1514  for (MooseIndex(scalar_variables) i = 0; i < scalar_variables.size(); ++i)
1515  scalar_variables[i]->scalingFactor(
1516  {1. / inverse_scaling_factors[offset + i] * scalar_variables[i]->scalingFactor()});
1517 
1518  if (thread == 0 && _verbose)
1519  {
1520  _console << "Automatic scaling factors:\n";
1521  auto original_flags = _console.flags();
1522  auto original_precision = _console.precision();
1523  _console.unsetf(std::ios_base::floatfield);
1524  _console.precision(6);
1525 
1526  for (const auto & field_variable : field_variables)
1527  {
1528  const auto & factors = field_variable->arrayScalingFactor();
1529  _console << " " << field_variable->name() << ":";
1530  for (const auto i : make_range(field_variable->count()))
1531  _console << " " << factors[i];
1532  _console << "\n";
1533  }
1534  for (const auto & scalar_variable : scalar_variables)
1535  _console << " " << scalar_variable->name() << ": " << scalar_variable->scalingFactor()
1536  << "\n";
1537  _console << "\n" << std::endl;
1538 
1539  // restore state
1540  _console.flags(original_flags);
1541  _console.precision(original_precision);
1542  }
1543  }
1544 }
std::ios_base::fmtflags flags() const
Return the current flags.
Definition: ConsoleStream.C:56
void unsetf(std::ios_base::fmtflags mask) const
Unset format flags.
Definition: ConsoleStream.C:38
std::streamsize precision() const
Return the current precision.
Definition: ConsoleStream.C:44
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
bool _verbose
True if printing out additional information.
Definition: SystemBase.h:1058
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 525 of file NonlinearSystemBase.h.

526  {
528  }
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 4216 of file NonlinearSystemBase.C.

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

4217 {
4218  if (!hasVector("scaling_factors"))
4219  // No variables have indicated they need scaling
4220  return;
4221 
4222  auto & scaling_vector = getVector("scaling_factors");
4223 
4224  const auto & lm_mesh = _mesh.getMesh();
4225  const auto & dof_map = dofMap();
4226 
4227  const auto & field_variables = _vars[0].fieldVariables();
4228  const auto & scalar_variables = _vars[0].scalars();
4229 
4230  std::vector<dof_id_type> dof_indices;
4231 
4232  for (const Elem * const elem :
4233  as_range(lm_mesh.active_local_elements_begin(), lm_mesh.active_local_elements_end()))
4234  for (const auto * const field_var : field_variables)
4235  {
4236  const auto & factors = field_var->arrayScalingFactor();
4237  for (const auto i : make_range(field_var->count()))
4238  {
4239  dof_map.dof_indices(elem, dof_indices, field_var->number() + i);
4240  for (const auto dof : dof_indices)
4241  scaling_vector.set(dof, factors[i]);
4242  }
4243  }
4244 
4245  for (const auto * const scalar_var : scalar_variables)
4246  {
4247  mooseAssert(scalar_var->count() == 1,
4248  "Scalar variables should always have only one component.");
4249  dof_map.SCALAR_dof_indices(dof_indices, scalar_var->number());
4250  for (const auto dof : dof_indices)
4251  scaling_vector.set(dof, scalar_var->scalingFactor());
4252  }
4253 
4254  // Parallel assemble
4255  scaling_vector.close();
4256 
4257  if (auto * displaced_problem = _fe_problem.getDisplacedProblem().get())
4258  // copy into the corresponding displaced system vector because they should be the exact same
4259  displaced_problem->systemBaseNonlinear(number()).getVector("scaling_factors") = scaling_vector;
4260 }
std::shared_ptr< DisplacedProblem > displaced_problem
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:925
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1164
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3575
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
MooseMesh & _mesh
Definition: SystemBase.h:991
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:934

◆ assignMaxVarNDofsPerElem()

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

assign the maximum element dofs

Definition at line 598 of file SystemBase.h.

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

◆ assignMaxVarNDofsPerNode()

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

assign the maximum node dofs

Definition at line 603 of file SystemBase.h.

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

◆ associateMatrixToTag()

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

Associate a matrix to a tag.

Reimplemented in DisplacedSystem.

Definition at line 1077 of file SystemBase.C.

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

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

◆ associateVectorToTag()

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

Associate a vector for a given tag.

Reimplemented in DisplacedSystem.

Definition at line 982 of file SystemBase.C.

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

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

◆ attachPreconditioner()

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

Attach a customized preconditioner that requires physics knowledge.

Generic preconditioners should be implemented in PETSc, instead.

Implements NonlinearSystemBase.

Definition at line 354 of file NonlinearSystem.C.

355 {
356  nonlinearSolver()->attach_preconditioner(preconditioner);
357 }
virtual libMesh::NonlinearSolver< Number > * nonlinearSolver() override

◆ augmentSendList()

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

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

Reimplemented in DisplacedSystem.

Definition at line 453 of file SystemBase.C.

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

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

◆ augmentSparsity()

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

Will modify the sparsity pattern to add logical geometric connections.

Implements SystemBase.

Definition at line 3589 of file NonlinearSystemBase.C.

3592 {
3594  {
3596 
3597  std::unordered_map<dof_id_type, std::vector<dof_id_type>> graph;
3598 
3600 
3603  graph);
3604 
3605  const dof_id_type first_dof_on_proc = dofMap().first_dof(processor_id());
3606  const dof_id_type end_dof_on_proc = dofMap().end_dof(processor_id());
3607 
3608  // The total number of dofs on and off processor
3609  const dof_id_type n_dofs_on_proc = dofMap().n_local_dofs();
3610  const dof_id_type n_dofs_not_on_proc = dofMap().n_dofs() - dofMap().n_local_dofs();
3611 
3612  for (const auto & git : graph)
3613  {
3614  dof_id_type dof = git.first;
3615  dof_id_type local_dof = dof - first_dof_on_proc;
3616 
3617  if (dof < first_dof_on_proc || dof >= end_dof_on_proc)
3618  continue;
3619 
3620  const auto & row = git.second;
3621 
3622  SparsityPattern::Row & sparsity_row = sparsity[local_dof];
3623 
3624  unsigned int original_row_length = sparsity_row.size();
3625 
3626  sparsity_row.insert(sparsity_row.end(), row.begin(), row.end());
3627 
3629  sparsity_row.begin(), sparsity_row.begin() + original_row_length, sparsity_row.end());
3630 
3631  // Fix up nonzero arrays
3632  for (const auto & coupled_dof : row)
3633  {
3634  if (coupled_dof < first_dof_on_proc || coupled_dof >= end_dof_on_proc)
3635  {
3636  if (n_oz[local_dof] < n_dofs_not_on_proc)
3637  n_oz[local_dof]++;
3638  }
3639  else
3640  {
3641  if (n_nz[local_dof] < n_dofs_on_proc)
3642  n_nz[local_dof]++;
3643  }
3644  }
3645  }
3646  }
3647 }
dof_id_type end_dof(const processor_id_type proc) const
void findImplicitGeometricCouplingEntries(GeometricSearchData &geom_search_data, std::unordered_map< dof_id_type, std::vector< dof_id_type >> &graph)
Finds the implicit sparsity graph between geometrically related dofs.
dof_id_type n_dofs(const unsigned int vn) const
dof_id_type n_local_dofs(const unsigned int vn) const
virtual GeometricSearchData & geomSearchData() override
std::vector< dof_id_type, Threads::scalable_allocator< dof_id_type > > Row
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1164
virtual void updateGeomSearch(GeometricSearchData::GeometricSearchType type=GeometricSearchData::ALL) override
bool _add_implicit_geometric_coupling_entries_to_jacobian
Whether or not to add implicit geometric couplings to the Jacobian for FDP.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
dof_id_type first_dof(const processor_id_type proc) const
processor_id_type processor_id() const
uint8_t dof_id_type
static void sort_row(const BidirectionalIterator begin, BidirectionalIterator middle, const BidirectionalIterator end)

◆ automaticScaling() [1/2]

bool SystemBase::automaticScaling ( ) const
inlineinherited

Getter for whether we are performing automatic scaling.

Returns
whether we are performing automatic scaling

Definition at line 123 of file SystemBase.h.

Referenced by SubProblem::automaticScaling().

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

◆ automaticScaling() [2/2]

void SystemBase::automaticScaling ( bool  automatic_scaling)
inlineinherited

Setter for whether we are performing automatic scaling.

Parameters
automatic_scalingA boolean representing whether we are performing automatic scaling

Definition at line 129 of file SystemBase.h.

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

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

731  {
732  _resid_vs_jac_scaling_param = resid_vs_jac_scaling_param;
733  }
Real _resid_vs_jac_scaling_param
The param that indicates the weighting of the residual vs the Jacobian in determining variable scalin...

◆ buildSystemDoFIndices()

void MooseEigenSystem::buildSystemDoFIndices ( SYSTEMTAG  tag = ALL)

Build DoF indices for a system.

Definition at line 227 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::init().

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

◆ checkInvalidSolution()

void SolverSystem::checkInvalidSolution ( )
protectedinherited

Definition at line 165 of file SolverSystem.C.

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

166 {
167  auto & solution_invalidity = _app.solutionInvalidity();
168 
169  // sync all solution invalid counts to rank 0 process
170  solution_invalidity.syncIteration();
171 
172  if (solution_invalidity.hasInvalidSolution())
173  {
176  solution_invalidity.print(_console);
177  else
178  mooseWarning("The Solution Invalidity warnings are detected but silenced! "
179  "Use Problem/show_invalid_solution_console=true to show solution counts");
180  else
181  // output the occurrence of solution invalid in a summary table
183  solution_invalidity.print(_console);
184  }
185 }
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:345
void syncIteration()
Sync iteration counts to main processor Sum across all processors.
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:184
bool showInvalidSolutionConsole() const
Whether or not to print out the invalid solutions summary table in console.
MooseApp & _app
Definition: SystemBase.h:988
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
bool acceptInvalidSolution() const
Whether or not to accept the solution based on its invalidity.
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.

◆ checkKernelCoverage()

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

System Integrity Checks

Definition at line 3711 of file NonlinearSystemBase.C.

3712 {
3713  // Obtain all blocks and variables covered by all kernels
3714  std::set<SubdomainID> input_subdomains;
3715  std::set<std::string> kernel_variables;
3716 
3717  bool global_kernels_exist = false;
3718  global_kernels_exist |= _scalar_kernels.hasActiveObjects();
3719  global_kernels_exist |= _nodal_kernels.hasActiveObjects();
3720 
3721  _kernels.subdomainsCovered(input_subdomains, kernel_variables);
3722  _dg_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3723  _nodal_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3724  _scalar_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3725  _constraints.subdomainsCovered(input_subdomains, kernel_variables);
3726 
3727 #ifdef MOOSE_KOKKOS_ENABLED
3728  _kokkos_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3729  _kokkos_nodal_kernels.subdomainsCovered(input_subdomains, kernel_variables);
3730 #endif
3731 
3732  if (_fe_problem.haveFV())
3733  {
3734  std::vector<FVElementalKernel *> fv_elemental_kernels;
3736  .query()
3737  .template condition<AttribSystem>("FVElementalKernel")
3738  .queryInto(fv_elemental_kernels);
3739 
3740  for (auto fv_kernel : fv_elemental_kernels)
3741  {
3742  if (fv_kernel->blockRestricted())
3743  for (auto block_id : fv_kernel->blockIDs())
3744  input_subdomains.insert(block_id);
3745  else
3746  global_kernels_exist = true;
3747  kernel_variables.insert(fv_kernel->variable().name());
3748 
3749  // Check for lagrange multiplier
3750  if (dynamic_cast<FVScalarLagrangeMultiplierConstraint *>(fv_kernel))
3751  kernel_variables.insert(dynamic_cast<FVScalarLagrangeMultiplierConstraint *>(fv_kernel)
3752  ->lambdaVariable()
3753  .name());
3754  }
3755 
3756  std::vector<FVFluxKernel *> fv_flux_kernels;
3758  .query()
3759  .template condition<AttribSystem>("FVFluxKernel")
3760  .queryInto(fv_flux_kernels);
3761 
3762  for (auto fv_kernel : fv_flux_kernels)
3763  {
3764  if (fv_kernel->blockRestricted())
3765  for (auto block_id : fv_kernel->blockIDs())
3766  input_subdomains.insert(block_id);
3767  else
3768  global_kernels_exist = true;
3769  kernel_variables.insert(fv_kernel->variable().name());
3770  }
3771 
3772  std::vector<FVInterfaceKernel *> fv_interface_kernels;
3774  .query()
3775  .template condition<AttribSystem>("FVInterfaceKernel")
3776  .queryInto(fv_interface_kernels);
3777 
3778  for (auto fvik : fv_interface_kernels)
3779  if (auto scalar_fvik = dynamic_cast<FVScalarLagrangeMultiplierInterface *>(fvik))
3780  kernel_variables.insert(scalar_fvik->lambdaVariable().name());
3781 
3782  std::vector<FVFluxBC *> fv_flux_bcs;
3784  .query()
3785  .template condition<AttribSystem>("FVFluxBC")
3786  .queryInto(fv_flux_bcs);
3787 
3788  for (auto fvbc : fv_flux_bcs)
3789  if (auto scalar_fvbc = dynamic_cast<FVBoundaryScalarLagrangeMultiplierConstraint *>(fvbc))
3790  kernel_variables.insert(scalar_fvbc->lambdaVariable().name());
3791  }
3792 
3793  for (const auto & ibc : _integrated_bcs.getActiveObjects())
3794  {
3795  const auto additional_variables_covered = ibc->additionalROVariables();
3796  kernel_variables.insert(additional_variables_covered.begin(),
3797  additional_variables_covered.end());
3798  }
3799 
3800  // Check kernel coverage of subdomains (blocks) in your mesh
3801  if (!global_kernels_exist)
3802  {
3803  std::set<SubdomainID> difference;
3804  std::set_difference(mesh_subdomains.begin(),
3805  mesh_subdomains.end(),
3806  input_subdomains.begin(),
3807  input_subdomains.end(),
3808  std::inserter(difference, difference.end()));
3809 
3810  // there supposed to be no kernels on this lower-dimensional subdomain
3811  for (const auto & id : _mesh.interiorLowerDBlocks())
3812  difference.erase(id);
3813  for (const auto & id : _mesh.boundaryLowerDBlocks())
3814  difference.erase(id);
3815 
3816  if (!difference.empty())
3817  {
3818  std::vector<SubdomainID> difference_vec =
3819  std::vector<SubdomainID>(difference.begin(), difference.end());
3820  std::vector<SubdomainName> difference_names = _mesh.getSubdomainNames(difference_vec);
3821  std::stringstream missing_block_names;
3822  std::copy(difference_names.begin(),
3823  difference_names.end(),
3824  std::ostream_iterator<std::string>(missing_block_names, " "));
3825  std::stringstream missing_block_ids;
3826  std::copy(difference.begin(),
3827  difference.end(),
3828  std::ostream_iterator<unsigned int>(missing_block_ids, " "));
3829 
3830  mooseError("Each subdomain must contain at least one Kernel.\nThe following block(s) lack an "
3831  "active kernel: " +
3832  missing_block_names.str(),
3833  " (ids: ",
3834  missing_block_ids.str(),
3835  ")");
3836  }
3837  }
3838 
3839  // Check kernel use of variables
3840  std::set<VariableName> variables(getVariableNames().begin(), getVariableNames().end());
3841 
3842  std::set<VariableName> difference;
3843  std::set_difference(variables.begin(),
3844  variables.end(),
3845  kernel_variables.begin(),
3846  kernel_variables.end(),
3847  std::inserter(difference, difference.end()));
3848 
3849  // skip checks for varaibles defined on lower-dimensional subdomain
3850  std::set<VariableName> vars(difference);
3851  for (auto & var_name : vars)
3852  {
3853  auto blks = getSubdomainsForVar(var_name);
3854  for (const auto & id : blks)
3855  if (_mesh.interiorLowerDBlocks().count(id) > 0 || _mesh.boundaryLowerDBlocks().count(id) > 0)
3856  difference.erase(var_name);
3857  }
3858 
3859  if (!difference.empty())
3860  {
3861  std::stringstream missing_kernel_vars;
3862  std::copy(difference.begin(),
3863  difference.end(),
3864  std::ostream_iterator<std::string>(missing_kernel_vars, " "));
3865  mooseError("Each variable must be referenced by at least one active Kernel.\nThe following "
3866  "variable(s) lack an active kernel: " +
3867  missing_kernel_vars.str());
3868  }
3869 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_kernels
const std::set< SubdomainID > & interiorLowerDBlocks() const
Definition: MooseMesh.h:1549
MooseObjectTagWarehouse< ResidualObject > _kokkos_kernels
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:311
char ** vars
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...
TheWarehouse & theWarehouse() const
void subdomainsCovered(std::set< SubdomainID > &subdomains_covered, std::set< std::string > &unique_variables, THREAD_ID tid=0) const
Populates a set of covered subdomains and the associated variable names.
MooseObjectTagWarehouse< KernelBase > _kernels
const std::set< SubdomainID > & boundaryLowerDBlocks() const
Definition: MooseMesh.h:1553
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:1791
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
MooseMesh & _mesh
Definition: SystemBase.h:991
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:467
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:863
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
Definition: SystemBase.h:764
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< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels

◆ clearAllDofIndices()

void SystemBase::clearAllDofIndices ( )
inherited

Clear all dof indices from moose variables.

Definition at line 1602 of file SystemBase.C.

Referenced by SubProblem::clearAllDofIndices().

1603 {
1604  for (auto & var_warehouse : _vars)
1605  var_warehouse.clearAllDofIndices();
1606 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

◆ clearFixedPointRelaxation()

void SolverSystem::clearFixedPointRelaxation ( )
inherited

Definition at line 85 of file SolverSystem.C.

86 {
88 }
Real _fixed_point_relaxation_factor
Used for relaxing entire system solution during fixed point (multi-)system iterations.
Definition: SolverSystem.h:131

◆ closeTaggedMatrices()

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

Close all matrices associated the tags.

Definition at line 1061 of file SystemBase.C.

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

1062 {
1063  for (auto tag : tags)
1064  if (hasMatrix(tag))
1065  getMatrix(tag).close();
1066 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:361
virtual void close()=0
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025

◆ closeTaggedVector()

void SystemBase::closeTaggedVector ( const TagID  tag)
inherited

Close vector with the given tag.

Definition at line 650 of file SystemBase.C.

Referenced by SystemBase::closeTaggedVectors().

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

◆ closeTaggedVectors()

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

Close all vectors for given tags.

Definition at line 668 of file SystemBase.C.

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

669 {
670  for (const auto tag : tags)
671  closeTaggedVector(tag);
672 }
void closeTaggedVector(const TagID tag)
Close vector with the given tag.
Definition: SystemBase.C:650

◆ combineSystemSolution()

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

Linear combination of the solution vectors.

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

Definition at line 104 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::chebyshev().

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

◆ compute()

void SolverSystem::compute ( ExecFlagType  type)
overridevirtualinherited

Compute time derivatives, auxiliary variables, etc.

Parameters
typeOur current execution stage

Implements SystemBase.

Reimplemented in LinearSystem.

Definition at line 188 of file SolverSystem.C.

189 {
190  // Let's try not to overcompute
191  bool compute_tds = false;
192  if (type == EXEC_LINEAR)
193  compute_tds = true;
194  else if (type == EXEC_NONLINEAR)
195  {
197  compute_tds = true;
198  }
199  else if ((type == EXEC_TIMESTEP_END) || (type == EXEC_FINAL))
200  {
202  // We likely don't have a final residual evaluation upon which we compute the time derivatives
203  // so we need to do so now
204  compute_tds = true;
205  }
206 
207  // avoid division by dt which might be zero.
208  if (compute_tds && _fe_problem.dt() > 0.)
209  for (auto & ti : _time_integrators)
210  {
211  // Do things like compute integration weights
212  ti->preStep();
213  ti->computeTimeDerivatives();
214  }
215 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049
Solving a linear problem.
Definition: MooseTypes.h:897
const ExecFlagType EXEC_TIMESTEP_END
Definition: Moose.C:36
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we&#39;re computing the scaling jacobian.
virtual bool matrixFromColoring() const
Whether a system matrix is formed from coloring.
Definition: SolverSystem.h:117
Moose::SolveType _type
Definition: SolverParams.h:19
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
const ExecFlagType EXEC_LINEAR
Definition: Moose.C:31
const ExecFlagType EXEC_NONLINEAR
Definition: Moose.C:33
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.
virtual Real & dt() const
const ExecFlagType EXEC_FINAL
Definition: Moose.C:46

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

Referenced by FEProblemBase::computeDamping().

3428 {
3429  // Default to no damping
3430  Real damping = 1.0;
3431  bool has_active_dampers = false;
3432 
3433  try
3434  {
3436  {
3437  PARALLEL_TRY
3438  {
3439  TIME_SECTION("computeDampers", 3, "Computing Dampers");
3440  has_active_dampers = true;
3444  damping = std::min(cid.damping(), damping);
3445  }
3446  PARALLEL_CATCH;
3447  }
3448 
3450  {
3451  PARALLEL_TRY
3452  {
3453  TIME_SECTION("computeDamping::element", 3, "Computing Element Damping");
3454 
3455  has_active_dampers = true;
3459  damping = std::min(cndt.damping(), damping);
3460  }
3461  PARALLEL_CATCH;
3462  }
3463 
3465  {
3466  PARALLEL_TRY
3467  {
3468  TIME_SECTION("computeDamping::general", 3, "Computing General Damping");
3469 
3470  has_active_dampers = true;
3471  const auto & gdampers = _general_dampers.getActiveObjects();
3472  for (const auto & damper : gdampers)
3473  {
3474  Real gd_damping = damper->computeDamping(solution, update);
3475  try
3476  {
3477  damper->checkMinDamping(gd_damping);
3478  }
3479  catch (MooseException & e)
3480  {
3482  }
3483  damping = std::min(gd_damping, damping);
3484  }
3485  }
3486  PARALLEL_CATCH;
3487  }
3488  }
3489  catch (MooseException & e)
3490  {
3491  // The buck stops here, we have already handled the exception by
3492  // calling stopSolve(), it is now up to PETSc to return a
3493  // "diverged" reason during the next solve.
3494  }
3495  catch (std::exception & e)
3496  {
3497  // Allow the libmesh error/exception on negative jacobian
3498  const std::string & message = e.what();
3499  if (message.find("Jacobian") == std::string::npos)
3500  throw;
3501  }
3502 
3503  _communicator.min(damping);
3504 
3505  if (has_active_dampers && damping < 1.0)
3506  _console << " Damping factor: " << damping << std::endl;
3507 
3508  return damping;
3509 }
virtual const char * what() const
Get out the error message.
NumericVector< Number > & solution()
Definition: SystemBase.h:197
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class...
void parallel_reduce(const Range &range, Body &body, const Partitioner &, unsigned int n_threads=libMesh::n_threads())
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
const Parallel::Communicator & _communicator
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange()
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1244
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
void min(const T &r, T &o, Request &req) const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
Provides a way for users to bail out of the current solve.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool hasActiveObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
NumericVector< Number > * _increment_vec
increment vector
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
auto min(const L &left, const R &right)

◆ computeDiracContributions()

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

Definition at line 3512 of file NonlinearSystemBase.C.

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

3513 {
3515 
3516  std::set<const Elem *> dirac_elements;
3517 
3519  {
3520  TIME_SECTION("computeDirac", 3, "Computing DiracKernels");
3521 
3522  // TODO: Need a threading fix... but it's complicated!
3523  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); ++tid)
3524  {
3525  const auto & dkernels = _dirac_kernels.getActiveObjects(tid);
3526  for (const auto & dkernel : dkernels)
3527  {
3528  dkernel->clearPoints();
3529  dkernel->addPoints();
3530  }
3531  }
3532 
3533  ComputeDiracThread cd(_fe_problem, tags, is_jacobian);
3534 
3535  _fe_problem.getDiracElements(dirac_elements);
3536 
3537  DistElemRange range(dirac_elements.begin(), dirac_elements.end(), 1);
3538  // TODO: Make Dirac work thread!
3539  // Threads::parallel_reduce(range, cd);
3540 
3541  cd(range);
3542 
3543  if (is_jacobian)
3544  for (const auto tid : make_range(libMesh::n_threads()))
3546  }
3547 }
unsigned int n_threads()
virtual void getDiracElements(std::set< const Elem *> &elems) override
Fills "elems" with the elements that should be looped over for Dirac Kernels.
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
virtual void clearDiracInfo() override
Gets called before Dirac Kernels are asked to add the points they are supposed to be evaluated in...
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
bool hasActiveObjects(THREAD_ID tid=0) const
IntRange< T > make_range(T beg, T end)
unsigned int THREAD_ID
Definition: MooseTypes.h:237
virtual void addCachedJacobian(const THREAD_ID tid) override

◆ computedScalingJacobian()

bool NonlinearSystemBase::computedScalingJacobian ( ) const
inlineinherited

Definition at line 78 of file NonlinearSystemBase.h.

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

◆ computeJacobian() [1/2]

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

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

Definition at line 3266 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobian().

3267 {
3269 
3270  computeJacobianTags(tags);
3271 
3273 }
TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
Definition: SystemBase.C:1077
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1089
void computeJacobianTags(const std::set< TagID > &tags)
Computes multiple (tag associated) Jacobian matricese.

◆ computeJacobian() [2/2]

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

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

Definition at line 3253 of file NonlinearSystemBase.C.

3254 {
3255  _nl_matrix_tags.clear();
3256 
3257  auto & tags = _fe_problem.getMatrixTags();
3258 
3259  for (auto & tag : tags)
3260  _nl_matrix_tags.insert(tag.second);
3261 
3262  computeJacobian(jacobian, _nl_matrix_tags);
3263 }
void computeJacobian(libMesh::SparseMatrix< Number > &jacobian, const std::set< TagID > &tags)
Associate jacobian to systemMatrixTag, and then form a matrix for all the tags.
std::set< TagID > _nl_matrix_tags
Matrix tags to temporarily store all tags associated with the current system.
virtual std::map< TagName, TagID > & getMatrixTags()
Return all matrix tags in the system, where a tag is represented by a map from name to ID...
Definition: SubProblem.h:253
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986

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

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

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

◆ computeJacobianBlocks() [2/2]

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

Definition at line 3307 of file NonlinearSystemBase.C.

3309 {
3310  TIME_SECTION("computeJacobianBlocks", 3);
3311  FloatingPointExceptionGuard fpe_guard(_app);
3312 
3313  for (unsigned int i = 0; i < blocks.size(); i++)
3314  {
3315  SparseMatrix<Number> & jacobian = blocks[i]->_jacobian;
3316 
3317  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
3318  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
3319  PETSC_TRUE));
3321  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
3322  MAT_NEW_NONZERO_ALLOCATION_ERR,
3323  PETSC_TRUE));
3324 
3325  jacobian.zero();
3326  }
3327 
3328  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
3330 
3331  PARALLEL_TRY
3332  {
3335  Threads::parallel_reduce(elem_range, cjb);
3336  }
3337  PARALLEL_CATCH;
3338 
3339  for (unsigned int i = 0; i < blocks.size(); i++)
3340  blocks[i]->_jacobian.close();
3341 
3342  for (unsigned int i = 0; i < blocks.size(); i++)
3343  {
3344  libMesh::System & precond_system = blocks[i]->_precond_system;
3345  SparseMatrix<Number> & jacobian = blocks[i]->_jacobian;
3346 
3347  unsigned int ivar = blocks[i]->_ivar;
3348  unsigned int jvar = blocks[i]->_jvar;
3349 
3350  // Dirichlet BCs
3351  std::vector<numeric_index_type> zero_rows;
3352  PARALLEL_TRY
3353  {
3355  for (const auto & bnode : bnd_nodes)
3356  {
3357  BoundaryID boundary_id = bnode->_bnd_id;
3358  Node * node = bnode->_node;
3359 
3360  if (_nodal_bcs.hasActiveBoundaryObjects(boundary_id))
3361  {
3362  const auto & bcs = _nodal_bcs.getActiveBoundaryObjects(boundary_id);
3363 
3364  if (node->processor_id() == processor_id())
3365  {
3366  _fe_problem.reinitNodeFace(node, boundary_id, 0);
3367 
3368  for (const auto & bc : bcs)
3369  if (bc->variable().number() == ivar && bc->shouldApply())
3370  {
3371  // The first zero is for the variable number... there is only one variable in
3372  // each mini-system The second zero only works with Lagrange elements!
3373  zero_rows.push_back(node->dof_number(precond_system.number(), 0, 0));
3374  }
3375  }
3376  }
3377  }
3378  }
3379  PARALLEL_CATCH;
3380 
3381  jacobian.close();
3382 
3383  // This zeroes the rows corresponding to Dirichlet BCs and puts a 1.0 on the diagonal
3384  if (ivar == jvar)
3385  jacobian.zero_rows(zero_rows, 1.0);
3386  else
3387  jacobian.zero_rows(zero_rows, 0.0);
3388 
3389  jacobian.close();
3390  }
3391 }
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
unsigned int n_threads()
char ** blocks
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
void parallel_reduce(const Range &range, Body &body, const Partitioner &, unsigned int n_threads=libMesh::n_threads())
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
Scope guard for starting and stopping Floating Point Exception Trapping.
Specialization for filling multiple "small" preconditioning matrices simulatenously.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
unsigned int number() const
virtual void zero()=0
boundary_id_type BoundaryID
virtual void zero_rows(std::vector< numeric_index_type > &rows, T diag_value=0.0)
bool errorOnJacobianNonzeroReallocation() const
Will return True if the user wants to get an error when a nonzero is reallocated in the Jacobian by P...
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
MooseApp & _app
Definition: SystemBase.h:988
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual void close()=0
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const

◆ computeJacobianInternal()

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

Form multiple matrices for all the tags.

Users should not call this func directly.

Definition at line 2989 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianTags().

2990 {
2991  TIME_SECTION("computeJacobianInternal", 3);
2992 
2994 
2995  // Make matrix ready to use
2997 
2998  for (auto tag : tags)
2999  {
3000  if (!hasMatrix(tag))
3001  continue;
3002 
3003  auto & jacobian = getMatrix(tag);
3004  // Necessary for speed
3005  if (auto petsc_matrix = dynamic_cast<PetscMatrix<Number> *>(&jacobian))
3006  {
3007  LibmeshPetscCall(MatSetOption(petsc_matrix->mat(),
3008  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
3009  PETSC_TRUE));
3011  LibmeshPetscCall(
3012  MatSetOption(petsc_matrix->mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE));
3014  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
3015  MAT_IGNORE_ZERO_ENTRIES,
3016  PETSC_TRUE));
3017  }
3018  }
3019 
3020  jacobianSetup();
3021 
3022  // Jacobian contributions from UOs - for now this is used for ray tracing
3023  // and ray kernels that contribute to the Jacobian (think line sources)
3024  std::vector<UserObject *> uos;
3026  .query()
3027  .condition<AttribSystem>("UserObject")
3028  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
3029  .queryInto(uos);
3030  for (auto & uo : uos)
3031  uo->jacobianSetup();
3032  for (auto & uo : uos)
3033  {
3034  uo->initialize();
3035  uo->execute();
3036  uo->finalize();
3037  }
3038 
3039  // reinit scalar variables
3040  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
3042 
3043 #ifdef MOOSE_KOKKOS_ENABLED
3045  computeKokkosJacobian(tags);
3046 #endif
3047 
3048  PARALLEL_TRY
3049  {
3050  // We would like to compute ScalarKernels, block NodalKernels, FVFluxKernels, and mortar objects
3051  // up front because we want these included whether we are computing an ordinary Jacobian or a
3052  // Jacobian for determining variable scaling factors
3054 
3055  // Block restricted Nodal Kernels
3057  {
3060  Threads::parallel_reduce(range, cnkjt);
3061 
3062  unsigned int n_threads = libMesh::n_threads();
3063  for (unsigned int i = 0; i < n_threads;
3064  i++) // Add any cached jacobians that might be hanging around
3066  }
3067 
3069  if (_fe_problem.haveFV())
3070  {
3071  // the same loop works for both residual and jacobians because it keys
3072  // off of FEProblem's _currently_computing_jacobian parameter
3074  _fe_problem, this->number(), tags, /*on_displaced=*/false);
3076  Threads::parallel_reduce(faces, fvj);
3077  }
3079  displaced_problem && displaced_problem->haveFV())
3080  {
3082  _fe_problem, this->number(), tags, /*on_displaced=*/true);
3083  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
3084  displaced_problem->mesh().ownedFaceInfoEnd());
3085  Threads::parallel_reduce(faces, fvr);
3086  }
3087 
3089 
3090  // Get our element range for looping over
3092 
3094  {
3095  // Only compute Jacobians corresponding to the diagonals of volumetric compute objects
3096  // because this typically gives us a good representation of the physics. NodalBCs and
3097  // Constraints can introduce dramatically different scales (often order unity).
3098  // IntegratedBCs and/or InterfaceKernels may use penalty factors. DGKernels may be ok, but
3099  // they are almost always used in conjunction with Kernels
3101  Threads::parallel_reduce(elem_range, cj);
3102  unsigned int n_threads = libMesh::n_threads();
3103  for (unsigned int i = 0; i < n_threads;
3104  i++) // Add any Jacobian contributions still hanging around
3106 
3107  // Check whether any exceptions were thrown and propagate this information for parallel
3108  // consistency before
3109  // 1) we do parallel communication when closing tagged matrices
3110  // 2) early returning before reaching our PARALLEL_CATCH below
3112 
3113  closeTaggedMatrices(tags);
3114 
3115  return;
3116  }
3117 
3118  switch (_fe_problem.coupling())
3119  {
3120  case Moose::COUPLING_DIAG:
3121  {
3123  Threads::parallel_reduce(elem_range, cj);
3124 
3125  unsigned int n_threads = libMesh::n_threads();
3126  for (unsigned int i = 0; i < n_threads;
3127  i++) // Add any Jacobian contributions still hanging around
3129 
3130  // Boundary restricted Nodal Kernels
3132  {
3135 
3136  Threads::parallel_reduce(bnd_range, cnkjt);
3137  unsigned int n_threads = libMesh::n_threads();
3138  for (unsigned int i = 0; i < n_threads;
3139  i++) // Add any cached jacobians that might be hanging around
3141  }
3142  }
3143  break;
3144 
3145  default:
3147  {
3149  Threads::parallel_reduce(elem_range, cj);
3150  unsigned int n_threads = libMesh::n_threads();
3151 
3152  for (unsigned int i = 0; i < n_threads; i++)
3154 
3155  // Boundary restricted Nodal Kernels
3157  {
3160 
3161  Threads::parallel_reduce(bnd_range, cnkjt);
3162  unsigned int n_threads = libMesh::n_threads();
3163  for (unsigned int i = 0; i < n_threads;
3164  i++) // Add any cached jacobians that might be hanging around
3166  }
3167  }
3168  break;
3169  }
3170 
3171  computeDiracContributions(tags, true);
3172 
3173  static bool first = true;
3174 
3175  // This adds zeroes into geometric coupling entries to ensure they stay in the matrix
3176  if ((_fe_problem.restoreOriginalNonzeroPattern() || first) &&
3178  {
3179  first = false;
3181 
3184  }
3185  }
3186  PARALLEL_CATCH;
3187 
3188  // Have no idea how to have constraints work
3189  // with the tag system
3190  PARALLEL_TRY
3191  {
3192  // Add in Jacobian contributions from other Constraints
3193  if (_fe_problem._has_constraints && tags.count(systemMatrixTag()))
3194  {
3195  // Some constraints need to be able to read values from the Jacobian, which requires that it
3196  // be closed/assembled
3197  auto & system_matrix = getMatrix(systemMatrixTag());
3198  std::unique_ptr<SparseMatrix<Number>> hash_copy;
3199  const SparseMatrix<Number> * view_jac_ptr;
3200  auto make_readable_jacobian = [&]()
3201  {
3202 #if PETSC_RELEASE_GREATER_EQUALS(3, 23, 0)
3203  if (system_matrix.use_hash_table())
3204  {
3205  hash_copy = libMesh::cast_ref<PetscMatrix<Number> &>(system_matrix).copy_from_hash();
3206  view_jac_ptr = hash_copy.get();
3207  }
3208  else
3209  view_jac_ptr = &system_matrix;
3210 #else
3211  view_jac_ptr = &system_matrix;
3212 #endif
3213  if (view_jac_ptr == &system_matrix)
3214  system_matrix.close();
3215  };
3216 
3217  make_readable_jacobian();
3218 
3219  // Nodal Constraints
3220  const bool had_nodal_constraints = enforceNodalConstraintsJacobian(*view_jac_ptr);
3221  if (had_nodal_constraints)
3222  // We have to make a new readable Jacobian
3223  make_readable_jacobian();
3224 
3225  // Undisplaced Constraints
3226  constraintJacobians(*view_jac_ptr, false);
3227 
3228  // Displaced Constraints
3230  constraintJacobians(*view_jac_ptr, true);
3231  }
3232  }
3233  PARALLEL_CATCH;
3234 
3236  closeTaggedMatrices(tags);
3237 
3238  // We need to close the save_in variables on the aux system before NodalBCBases clear the dofs
3239  // on boundary nodes
3242 
3243  if (hasDiagSaveIn())
3245 
3246  // Accumulate the occurrence of solution invalid warnings for the current iteration cumulative
3247  // counters
3250 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
unsigned int n_threads()
bool hasActiveBlockObjects(THREAD_ID tid=0) const
std::shared_ptr< DisplacedProblem > displaced_problem
virtual void checkExceptionAndStopSolve(bool print_message=true)
Check to see if an exception has occurred on any processor and, if possible, force the solve to fail...
TagID systemMatrixTag() const override
Return the Matrix Tag ID for System.
NumericVector< Number > & solution()
Definition: SystemBase.h:197
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:1527
void accumulateIterationIntoTimeStepOccurences()
Pass the number of solution invalid occurrences from current iteration to cumulative counters...
bool _has_nodalbc_diag_save_in
If there is a nodal BC having diag_save_in.
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
void parallel_reduce(const Range &range, Body &body, const Partitioner &, unsigned int n_threads=libMesh::n_threads())
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:361
bool hasDiagSaveIn() const
Weather or not the nonlinear system has diagonal Jacobian save-ins.
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange()
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we&#39;re computing the scaling jacobian.
virtual GeometricSearchData & geomSearchData() override
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1244
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void activateAllMatrixTags()
Make all existing matrices active.
Definition: SystemBase.C:1132
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
void closeTaggedMatrices(const std::set< TagID > &tags)
Close all matrices associated the tags.
Definition: SystemBase.C:1061
void syncIteration()
Sync iteration counts to main processor Sum across all processors.
void setCurrentNonlinearSystem(const unsigned int nl_sys_num)
void computeDiracContributions(const std::set< TagID > &tags, bool is_jacobian)
TheWarehouse & theWarehouse() const
bool enforceNodalConstraintsJacobian(const SparseMatrix< Number > &jacobian)
Enforce nodal constraints in the Jacobian.
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:184
void addImplicitGeometricCouplingEntries(GeometricSearchData &geom_search_data)
Adds entries to the Jacobian in the correct positions for couplings coming from dofs being coupled th...
bool errorOnJacobianNonzeroReallocation() const
Will return True if the user wants to get an error when a nonzero is reallocated in the Jacobian by P...
Moose::CouplingType coupling() const
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
AuxiliarySystem & getAuxiliarySystem()
virtual void close()=0
void computeKokkosJacobian(const std::set< TagID > &tags)
Compute Jacobian with Kokkos objects.
bool _add_implicit_geometric_coupling_entries_to_jacobian
Whether or not to add implicit geometric couplings to the Jacobian for FDP.
MooseApp & _app
Definition: SystemBase.h:988
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual void close()=0
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025
bool hasKokkosResidualObjects() const
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:467
virtual MooseMesh & mesh() override
bool ignoreZerosInJacobian() const
Will return true if zeros in the Jacobian are to be dropped from the sparsity pattern.
void computeNodalBCsJacobian(const std::set< TagID > &tags)
Compute the Jacobian for nodal boundary conditions.
const ExecFlagType EXEC_PRE_KERNELS
Definition: Moose.C:56
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:285
bool restoreOriginalNonzeroPattern() const
face_info_iterator ownedFaceInfoEnd()
Definition: MooseMesh.C:1536
void constraintJacobians(const SparseMatrix< Number > &jacobian_to_view, bool displaced)
Add jacobian contributions from Constraints.
bool _has_constraints
Whether or not this system has any Constraints.
void addCachedJacobian(GlobalDataKey)
Adds the values that have been cached by calling cacheJacobian() and or cacheJacobianNeighbor() to th...
Definition: Assembly.C:3801
virtual void jacobianSetup() override
virtual void addCachedJacobian(const THREAD_ID tid) override
Key structure for APIs manipulating global vectors/matrices.
Definition: Assembly.h:844

◆ computeJacobianTags()

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

Computes multiple (tag associated) Jacobian matricese.

Definition at line 3276 of file NonlinearSystemBase.C.

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

3277 {
3278  TIME_SECTION("computeJacobianTags", 5);
3279 
3280  FloatingPointExceptionGuard fpe_guard(_app);
3281 
3282  try
3283  {
3285  }
3286  catch (MooseException & e)
3287  {
3288  // The buck stops here, we have already handled the exception by
3289  // calling stopSolve(), it is now up to PETSc to return a
3290  // "diverged" reason during the next solve.
3291  }
3292 }
Scope guard for starting and stopping Floating Point Exception Trapping.
MooseApp & _app
Definition: SystemBase.h:988
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.

◆ computeKokkosJacobian()

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

Compute Jacobian with Kokkos objects.

Referenced by NonlinearSystemBase::computeJacobianInternal().

◆ computeKokkosNodalBCsResidual()

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

◆ computeKokkosResidual()

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

Compute residual with Kokkos objects.

Referenced by NonlinearSystemBase::computeResidualInternal().

◆ computeKokkosResidualAndJacobian()

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

◆ computeNodalBCsJacobian()

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

Compute the Jacobian for nodal boundary conditions.

Definition at line 2179 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

2180 {
2181  // We need to close the save_in variables on the aux system before NodalBCBases clear the dofs
2182  // on boundary nodes
2183  if (_has_diag_save_in)
2185 
2186  MooseObjectWarehouse<NodalBCBase> * nbc_warehouse;
2187 
2188  // Select nodal kernels
2189  if (tags.size() == _fe_problem.numMatrixTags() || !tags.size())
2190  nbc_warehouse = &_nodal_bcs;
2191  else if (tags.size() == 1)
2192  nbc_warehouse = &(_nodal_bcs.getMatrixTagObjectWarehouse(*(tags.begin()), 0));
2193  else
2194  nbc_warehouse = &(_nodal_bcs.getMatrixTagsObjectWarehouse(tags, 0));
2195 
2196  // Return early if there is no nodal kernel
2197  if (!nbc_warehouse->hasActiveObjects())
2198  return;
2199 
2200  PARALLEL_TRY
2201  {
2202  // We may be switching from add to set. Moreover, we rely on a call to MatZeroRows to enforce
2203  // the nodal boundary condition constraints which requires that the matrix be truly assembled
2204  // as opposed to just flushed. Consequently we can't do the following despite any desire to
2205  // keep our initial sparsity pattern honored (see https://gitlab.com/petsc/petsc/-/issues/852)
2206  //
2207  // flushTaggedMatrices(tags);
2208  closeTaggedMatrices(tags);
2209 
2210  // Cache the information about which BCs are coupled to which
2211  // variables, so we don't have to figure it out for each node.
2212  std::map<std::string, std::set<unsigned int>> bc_involved_vars;
2213  const std::set<BoundaryID> & all_boundary_ids = _mesh.getBoundaryIDs();
2214  for (const auto & bid : all_boundary_ids)
2215  {
2216  // Get reference to all the NodalBCs for this ID. This is only
2217  // safe if there are NodalBCBases there to be gotten...
2218  if (nbc_warehouse->hasActiveBoundaryObjects(bid))
2219  {
2220  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(bid);
2221  for (const auto & bc : bcs)
2222  {
2223  const std::vector<MooseVariableFEBase *> & coupled_moose_vars = bc->getCoupledMooseVars();
2224 
2225  // Create the set of "involved" MOOSE nonlinear vars, which includes all coupled vars
2226  // and the BC's own variable
2227  std::set<unsigned int> & var_set = bc_involved_vars[bc->name()];
2228  for (const auto & coupled_var : coupled_moose_vars)
2229  if (coupled_var->kind() == Moose::VAR_SOLVER)
2230  var_set.insert(coupled_var->number());
2231 
2232  var_set.insert(bc->variable().number());
2233  }
2234  }
2235  }
2236 
2237  // reinit scalar variables again. This reinit does not re-fill any of the scalar variable
2238  // solution arrays because that was done above. It only will reorder the derivative
2239  // information for AD calculations to be suitable for NodalBC calculations
2240  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
2241  _fe_problem.reinitScalars(tid, true);
2242 
2243  // Get variable coupling list. We do all the NodalBCBase stuff on
2244  // thread 0... The couplingEntries() data structure determines
2245  // which variables are "coupled" as far as the preconditioner is
2246  // concerned, not what variables a boundary condition specifically
2247  // depends on.
2248  auto & coupling_entries = _fe_problem.couplingEntries(/*_tid=*/0, this->number());
2249 
2250  // Compute Jacobians for NodalBCBases
2252  for (const auto & bnode : bnd_nodes)
2253  {
2254  BoundaryID boundary_id = bnode->_bnd_id;
2255  Node * node = bnode->_node;
2256 
2257  if (nbc_warehouse->hasActiveBoundaryObjects(boundary_id) &&
2258  node->processor_id() == processor_id())
2259  {
2260  _fe_problem.reinitNodeFace(node, boundary_id, 0);
2261 
2262  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(boundary_id);
2263  for (const auto & bc : bcs)
2264  {
2265  // Get the set of involved MOOSE vars for this BC
2266  std::set<unsigned int> & var_set = bc_involved_vars[bc->name()];
2267 
2268  // Loop over all the variables whose Jacobian blocks are
2269  // actually being computed, call computeOffDiagJacobian()
2270  // for each one which is actually coupled (otherwise the
2271  // value is zero.)
2272  for (const auto & it : coupling_entries)
2273  {
2274  unsigned int ivar = it.first->number(), jvar = it.second->number();
2275 
2276  // We are only going to call computeOffDiagJacobian() if:
2277  // 1.) the BC's variable is ivar
2278  // 2.) jvar is "involved" with the BC (including jvar==ivar), and
2279  // 3.) the BC should apply.
2280  if ((bc->variable().number() == ivar) && var_set.count(jvar) && bc->shouldApply())
2281  bc->computeOffDiagJacobian(jvar);
2282  }
2283 
2284  const auto & coupled_scalar_vars = bc->getCoupledMooseScalarVars();
2285  for (const auto & jvariable : coupled_scalar_vars)
2286  if (hasScalarVariable(jvariable->name()))
2287  bc->computeOffDiagJacobianScalar(jvariable->number());
2288  }
2289  }
2290  } // end loop over boundary nodes
2291 
2292  // Set the cached NodalBCBase values in the Jacobian matrix
2294  }
2295  PARALLEL_CATCH;
2296 }
std::vector< std::pair< MooseVariableFEBase *, MooseVariableFEBase * > > & couplingEntries(const THREAD_ID tid, const unsigned int nl_sys_num)
unsigned int n_threads()
NumericVector< Number > & solution()
Definition: SystemBase.h:197
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 Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
void closeTaggedMatrices(const std::set< TagID > &tags)
Close all matrices associated the tags.
Definition: SystemBase.C:1061
boundary_id_type BoundaryID
MooseObjectWarehouse< T > & getMatrixTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given matrix tag...
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
AuxiliarySystem & getAuxiliarySystem()
virtual void close()=0
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:248
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
bool _has_diag_save_in
If there is any Kernel or IntegratedBC having diag_save_in.
MooseMesh & _mesh
Definition: SystemBase.h:991
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...
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
Definition: Assembly.C:4478
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. ...
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:877
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const
Key structure for APIs manipulating global vectors/matrices.
Definition: Assembly.h:844

◆ computeNodalBCsResidual() [1/3]

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

Enforces nodal boundary conditions.

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

Referenced by NonlinearSystemBase::computeResidualTags().

◆ computeNodalBCsResidual() [2/3]

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

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

◆ computeNodalBCsResidual() [3/3]

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

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

Definition at line 2118 of file NonlinearSystemBase.C.

2119 {
2120 #ifdef MOOSE_KOKKOS_ENABLED
2123 #endif
2124 
2125  // We need to close the diag_save_in variables on the aux system before NodalBCBases clear the
2126  // dofs on boundary nodes
2127  if (_has_save_in)
2129 
2130  // Select nodal kernels
2131  MooseObjectWarehouse<NodalBCBase> * nbc_warehouse;
2132 
2133  if (tags.size() == _fe_problem.numVectorTags(Moose::VECTOR_TAG_RESIDUAL) || !tags.size())
2134  nbc_warehouse = &_nodal_bcs;
2135  else if (tags.size() == 1)
2136  nbc_warehouse = &(_nodal_bcs.getVectorTagObjectWarehouse(*(tags.begin()), 0));
2137  else
2138  nbc_warehouse = &(_nodal_bcs.getVectorTagsObjectWarehouse(tags, 0));
2139 
2140  // Return early if there is no nodal kernel
2141  if (!nbc_warehouse->hasActiveObjects())
2142  return;
2143 
2144  PARALLEL_TRY
2145  {
2147 
2148  if (!bnd_nodes.empty())
2149  {
2150  TIME_SECTION("NodalBCs", 3 /*, "Computing NodalBCs"*/);
2151 
2152  for (const auto & bnode : bnd_nodes)
2153  {
2154  BoundaryID boundary_id = bnode->_bnd_id;
2155  Node * node = bnode->_node;
2156 
2157  if (node->processor_id() == processor_id() &&
2158  nbc_warehouse->hasActiveBoundaryObjects(boundary_id))
2159  {
2160  // reinit variables in nodes
2161  _fe_problem.reinitNodeFace(node, boundary_id, 0);
2162 
2163  const auto & bcs = nbc_warehouse->getActiveBoundaryObjects(boundary_id);
2164  for (const auto & nbc : bcs)
2165  if (nbc->shouldApply())
2166  nbc->computeResidual();
2167  }
2168  }
2169  }
2170  }
2171  PARALLEL_CATCH;
2172 
2173  if (_Re_time)
2174  _Re_time->close();
2175  _Re_non_time->close();
2176 }
NumericVector< Number > * _Re_time
residual vector for time contributions
bool empty() const
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
NumericVector< Number > & solution()
Definition: SystemBase.h:197
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
MooseObjectWarehouse< T > & getVectorTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object at least has one of the given vector ta...
bool _has_save_in
If there is any Kernel or IntegratedBC having save_in.
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
boundary_id_type BoundaryID
AuxiliarySystem & getAuxiliarySystem()
virtual void close()=0
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
void computeKokkosNodalBCsResidual(const std::set< TagID > &tags)
Compute Kokkos nodal BCs.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
bool hasActiveObjects(THREAD_ID tid=0) const
bool hasKokkosResidualObjects() const
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:196
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag...
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const

◆ computeNodalBCsResidualAndJacobian()

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

Compute the residual and Jacobian together for nodal boundary conditions.

Definition at line 2299 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualAndJacobianTags().

2302 {
2303 #ifdef MOOSE_KOKKOS_ENABLED
2305  computeKokkosNodalBCsResidual(vector_tags);
2306 #endif
2307 
2308  // Return early if there is no nodal kernel
2310  return;
2311 
2312  PARALLEL_TRY
2313  {
2315 
2316  if (!bnd_nodes.empty())
2317  {
2318  TIME_SECTION("NodalBCs", 3 /*, "Computing NodalBCs"*/);
2319 
2320  for (const auto & bnode : bnd_nodes)
2321  {
2322  BoundaryID boundary_id = bnode->_bnd_id;
2323  Node * node = bnode->_node;
2324 
2325  if (node->processor_id() == processor_id())
2326  {
2327  // reinit variables in nodes
2328  _fe_problem.reinitNodeFace(node, boundary_id, 0);
2329  if (_nodal_bcs.hasActiveBoundaryObjects(boundary_id))
2330  {
2331  const auto & bcs = _nodal_bcs.getActiveBoundaryObjects(boundary_id);
2332  for (const auto & nbc : bcs)
2333  if (nbc->shouldApply())
2334  nbc->computeResidualAndJacobian();
2335  }
2336  }
2337  }
2338  }
2339  }
2340  PARALLEL_CATCH;
2341 
2342  // Set the cached NodalBCBase values in the Jacobian matrix
2344 }
bool empty() const
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
boundary_id_type BoundaryID
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
void computeKokkosNodalBCsResidual(const std::set< TagID > &tags)
Compute Kokkos nodal BCs.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
bool hasActiveObjects(THREAD_ID tid=0) const
bool hasKokkosResidualObjects() const
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
Definition: Assembly.C:4478
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const
Key structure for APIs manipulating global vectors/matrices.
Definition: Assembly.h:844

◆ computeResidual()

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

Form a residual vector for a given tag.

Definition at line 822 of file NonlinearSystemBase.C.

823 {
824  mooseDeprecated(" Please use computeResidualTag");
825 
826  computeResidualTag(residual, tag_id);
827 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:363
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 1993 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualAndJacobianTags().

1995 {
1996  TIME_SECTION("computeResidualAndJacobianInternal", 3);
1997 
1998  // Make matrix ready to use
2000 
2001  for (auto tag : matrix_tags)
2002  {
2003  if (!hasMatrix(tag))
2004  continue;
2005 
2006  auto & jacobian = getMatrix(tag);
2007  // Necessary for speed
2008  if (auto petsc_matrix = dynamic_cast<PetscMatrix<Number> *>(&jacobian))
2009  {
2010  LibmeshPetscCall(MatSetOption(petsc_matrix->mat(),
2011  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2012  PETSC_TRUE));
2014  LibmeshPetscCall(
2015  MatSetOption(petsc_matrix->mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE));
2017  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2018  MAT_IGNORE_ZERO_ENTRIES,
2019  PETSC_TRUE));
2020  }
2021  }
2022 
2023  residualSetup();
2024 
2025  // Residual contributions from UOs - for now this is used for ray tracing
2026  // and ray kernels that contribute to the residual (think line sources)
2027  std::vector<UserObject *> uos;
2029  .query()
2030  .condition<AttribSystem>("UserObject")
2031  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
2032  .queryInto(uos);
2033  for (auto & uo : uos)
2034  uo->residualSetup();
2035  for (auto & uo : uos)
2036  {
2037  uo->initialize();
2038  uo->execute();
2039  uo->finalize();
2040  }
2041 
2042  // reinit scalar variables
2043  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
2045 
2046 #ifdef MOOSE_KOKKOS_ENABLED
2048  computeKokkosResidualAndJacobian(vector_tags, matrix_tags);
2049 #endif
2050 
2051  // residual contributions from the domain
2052  PARALLEL_TRY
2053  {
2054  TIME_SECTION("Kernels", 3 /*, "Computing Kernels"*/);
2055 
2057 
2058  ComputeResidualAndJacobianThread crj(_fe_problem, vector_tags, matrix_tags);
2059  Threads::parallel_reduce(elem_range, crj);
2060 
2062  if (_fe_problem.haveFV())
2063  {
2065  _fe_problem, this->number(), vector_tags, matrix_tags, /*on_displaced=*/false);
2067  Threads::parallel_reduce(faces, fvrj);
2068  }
2070  displaced_problem && displaced_problem->haveFV())
2071  {
2073  _fe_problem, this->number(), vector_tags, matrix_tags, /*on_displaced=*/true);
2074  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
2075  displaced_problem->mesh().ownedFaceInfoEnd());
2076  Threads::parallel_reduce(faces, fvr);
2077  }
2078 
2080 
2081  unsigned int n_threads = libMesh::n_threads();
2082  for (unsigned int i = 0; i < n_threads;
2083  i++) // Add any cached residuals that might be hanging around
2084  {
2087  }
2088  }
2089  PARALLEL_CATCH;
2090 }
unsigned int n_threads()
std::shared_ptr< DisplacedProblem > displaced_problem
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
Definition: MooseMesh.C:1527
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
void computeKokkosResidualAndJacobian(const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
void parallel_reduce(const Range &range, Body &body, const Partitioner &, unsigned int n_threads=libMesh::n_threads())
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:361
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
virtual void activateAllMatrixTags()
Make all existing matrices active.
Definition: SystemBase.C:1132
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...
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025
bool hasKokkosResidualObjects() const
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:467
virtual MooseMesh & mesh() override
bool ignoreZerosInJacobian() const
Will return true if zeros in the Jacobian are to be dropped from the sparsity pattern.
const ExecFlagType EXEC_PRE_KERNELS
Definition: Moose.C:56
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:285
face_info_iterator ownedFaceInfoEnd()
Definition: MooseMesh.C:1536
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 910 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computeResidualAndJacobian().

912 {
913  const bool required_residual =
914  vector_tags.find(residualVectorTag()) == vector_tags.end() ? false : true;
915 
916  try
917  {
918  zeroTaggedVectors(vector_tags);
919  computeResidualAndJacobianInternal(vector_tags, matrix_tags);
920  closeTaggedVectors(vector_tags);
921  closeTaggedMatrices(matrix_tags);
922 
923  if (required_residual)
924  {
925  auto & residual = getVector(residualVectorTag());
926  if (!_time_integrators.empty())
927  {
928  for (auto & ti : _time_integrators)
929  ti->postResidual(residual);
930  }
931  else
932  residual += *_Re_non_time;
933  residual.close();
934  }
935 
936  computeNodalBCsResidualAndJacobian(vector_tags, matrix_tags);
937  closeTaggedVectors(vector_tags);
938  closeTaggedMatrices(matrix_tags);
939  }
940  catch (MooseException & e)
941  {
942  // The buck stops here, we have already handled the exception by
943  // calling stopSolve(), it is now up to PETSc to return a
944  // "diverged" reason during the next solve.
945  }
946 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049
void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
Definition: SystemBase.C:694
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 computeNodalBCsResidualAndJacobian(const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags)
Compute the residual and Jacobian together for nodal boundary conditions.
void closeTaggedMatrices(const std::set< TagID > &tags)
Close all matrices associated the tags.
Definition: SystemBase.C:1061
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:668
virtual void close()=0
TagID residualVectorTag() const override
Provides a way for users to bail out of the current solve.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:934

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

Referenced by NonlinearSystemBase::computeResidualTags().

1771 {
1772  parallel_object_only();
1773 
1774  TIME_SECTION("computeResidualInternal", 3);
1775 
1776  residualSetup();
1777 
1778  // Residual contributions from UOs - for now this is used for ray tracing
1779  // and ray kernels that contribute to the residual (think line sources)
1780  std::vector<UserObject *> uos;
1782  .query()
1783  .condition<AttribSystem>("UserObject")
1784  .condition<AttribExecOns>(EXEC_PRE_KERNELS)
1785  .queryInto(uos);
1786  for (auto & uo : uos)
1787  uo->residualSetup();
1788  for (auto & uo : uos)
1789  {
1790  uo->initialize();
1791  uo->execute();
1792  uo->finalize();
1793  }
1794 
1795  // reinit scalar variables
1796  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
1798 
1799 #ifdef MOOSE_KOKKOS_ENABLED
1801  computeKokkosResidual(tags);
1802 #endif
1803 
1804  // residual contributions from the domain
1805  PARALLEL_TRY
1806  {
1807  TIME_SECTION("Kernels", 3 /*, "Computing Kernels"*/);
1808 
1810 
1812  Threads::parallel_reduce(elem_range, cr);
1813 
1814  // We pass face information directly to FV residual objects for their evaluation. Consequently
1815  // we must make sure to do separate threaded loops for 1) undisplaced face information objects
1816  // and undisplaced residual objects and 2) displaced face information objects and displaced
1817  // residual objects
1819  if (_fe_problem.haveFV())
1820  {
1822  _fe_problem, this->number(), tags, /*on_displaced=*/false);
1824  Threads::parallel_reduce(faces, fvr);
1825  }
1827  displaced_problem && displaced_problem->haveFV())
1828  {
1830  _fe_problem, this->number(), tags, /*on_displaced=*/true);
1831  FVRange faces(displaced_problem->mesh().ownedFaceInfoBegin(),
1832  displaced_problem->mesh().ownedFaceInfoEnd());
1833  Threads::parallel_reduce(faces, fvr);
1834  }
1835 
1836  unsigned int n_threads = libMesh::n_threads();
1837  for (unsigned int i = 0; i < n_threads;
1838  i++) // Add any cached residuals that might be hanging around
1840  }
1841  PARALLEL_CATCH;
1842 
1843  // residual contributions from the scalar kernels
1844  PARALLEL_TRY
1845  {
1846  // do scalar kernels (not sure how to thread this)
1848  {
1849  TIME_SECTION("ScalarKernels", 3 /*, "Computing ScalarKernels"*/);
1850 
1851  MooseObjectWarehouse<ScalarKernelBase> * scalar_kernel_warehouse;
1852  // This code should be refactored once we can do tags for scalar
1853  // kernels
1854  // Should redo this based on Warehouse
1855  if (!tags.size() || tags.size() == _fe_problem.numVectorTags(Moose::VECTOR_TAG_RESIDUAL))
1856  scalar_kernel_warehouse = &_scalar_kernels;
1857  else if (tags.size() == 1)
1858  scalar_kernel_warehouse =
1859  &(_scalar_kernels.getVectorTagObjectWarehouse(*(tags.begin()), 0));
1860  else
1861  // scalar_kernels is not threading
1862  scalar_kernel_warehouse = &(_scalar_kernels.getVectorTagsObjectWarehouse(tags, 0));
1863 
1864  bool have_scalar_contributions = false;
1865  const auto & scalars = scalar_kernel_warehouse->getActiveObjects();
1866  for (const auto & scalar_kernel : scalars)
1867  {
1868  scalar_kernel->reinit();
1869  const std::vector<dof_id_type> & dof_indices = scalar_kernel->variable().dofIndices();
1870  const DofMap & dof_map = scalar_kernel->variable().dofMap();
1871  const dof_id_type first_dof = dof_map.first_dof();
1872  const dof_id_type end_dof = dof_map.end_dof();
1873  for (dof_id_type dof : dof_indices)
1874  {
1875  if (dof >= first_dof && dof < end_dof)
1876  {
1877  scalar_kernel->computeResidual();
1878  have_scalar_contributions = true;
1879  break;
1880  }
1881  }
1882  }
1883  if (have_scalar_contributions)
1885  }
1886  }
1887  PARALLEL_CATCH;
1888 
1889  // residual contributions from Block NodalKernels
1890  PARALLEL_TRY
1891  {
1893  {
1894  TIME_SECTION("NodalKernels", 3 /*, "Computing NodalKernels"*/);
1895 
1897 
1899 
1900  if (range.begin() != range.end())
1901  {
1902  _fe_problem.reinitNode(*range.begin(), 0);
1903 
1904  Threads::parallel_reduce(range, cnk);
1905 
1906  unsigned int n_threads = libMesh::n_threads();
1907  for (unsigned int i = 0; i < n_threads;
1908  i++) // Add any cached residuals that might be hanging around
1910  }
1911  }
1912  }
1913  PARALLEL_CATCH;
1914 
1916  // We computed the volumetric objects. We can return now before we get into
1917  // any strongly enforced constraint conditions or penalty-type objects
1918  // (DGKernels, IntegratedBCs, InterfaceKernels, Constraints)
1919  return;
1920 
1921  // residual contributions from boundary NodalKernels
1922  PARALLEL_TRY
1923  {
1925  {
1926  TIME_SECTION("NodalKernelBCs", 3 /*, "Computing NodalKernelBCs"*/);
1927 
1929 
1931 
1932  Threads::parallel_reduce(bnd_node_range, cnk);
1933 
1934  unsigned int n_threads = libMesh::n_threads();
1935  for (unsigned int i = 0; i < n_threads;
1936  i++) // Add any cached residuals that might be hanging around
1938  }
1939  }
1940  PARALLEL_CATCH;
1941 
1943 
1944  if (_residual_copy.get())
1945  {
1946  _Re_non_time->close();
1948  }
1949 
1951  {
1952  _Re_non_time->close();
1955  }
1956 
1957  PARALLEL_TRY { computeDiracContributions(tags, false); }
1958  PARALLEL_CATCH;
1959 
1961  {
1962  PARALLEL_TRY { enforceNodalConstraintsResidual(*_Re_non_time); }
1963  PARALLEL_CATCH;
1964  _Re_non_time->close();
1965  }
1966 
1967  // Add in Residual contributions from other Constraints
1969  {
1970  PARALLEL_TRY
1971  {
1972  // Undisplaced Constraints
1974 
1975  // Displaced Constraints
1978 
1981  }
1982  PARALLEL_CATCH;
1983  _Re_non_time->close();
1984  }
1985 
1986  // Accumulate the occurrence of solution invalid warnings for the current iteration cumulative
1987  // counters
1990 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
dof_id_type end_dof(const processor_id_type proc) const
unsigned int n_threads()
bool hasActiveBlockObjects(THREAD_ID tid=0) const
std::shared_ptr< DisplacedProblem > displaced_problem
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
virtual void reinitNode(const Node *node, const THREAD_ID tid) override
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
Definition: MooseMesh.C:1527
void accumulateIterationIntoTimeStepOccurences()
Pass the number of solution invalid occurrences from current iteration to cumulative counters...
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
void parallel_reduce(const Range &range, Body &body, const Partitioner &, unsigned int n_threads=libMesh::n_threads())
MooseObjectWarehouse< T > & getVectorTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object at least has one of the given vector ta...
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
const libMesh::ConstNodeRange & getCurrentAlgebraicNodeRange()
void constraintResiduals(NumericVector< Number > &residual, bool displaced)
Add residual contributions from Constraints.
const Variable & variable(const unsigned int c) const override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
void syncIteration()
Sync iteration counts to main processor Sum across all processors.
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:184
void computingScalingResidual(bool computing_scaling_residual)
Setter for whether we&#39;re computing the scaling residual.
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
virtual void close()=0
ConstraintWarehouse _constraints
Constraints storage object.
void computingNonlinearResid(bool computing_nonlinear_residual) final
Set whether or not the problem is in the process of computing the nonlinear residual.
const_iterator end() const
MooseApp & _app
Definition: SystemBase.h:988
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
std::unique_ptr< NumericVector< Number > > _residual_copy
Copy of the residual vector, or nullptr if a copy is not needed.
bool hasActiveObjects(THREAD_ID tid=0) const
bool hasKokkosResidualObjects() const
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:467
const_iterator begin() const
void computeKokkosResidual(const std::set< TagID > &tags)
Compute residual with Kokkos objects.
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:196
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:56
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:285
face_info_iterator ownedFaceInfoEnd()
Definition: MooseMesh.C:1536
bool _has_constraints
Whether or not this system has any Constraints.
dof_id_type first_dof(const processor_id_type proc) const
void enforceNodalConstraintsResidual(NumericVector< Number > &residual)
Enforce nodal constraints.
virtual void addResidualScalar(const THREAD_ID tid=0)
virtual void addCachedResidual(const THREAD_ID tid) override
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
virtual void residualEnd(THREAD_ID tid=0) const
uint8_t dof_id_type
virtual void residualSetup() override
virtual void localize(std::vector< T > &v_local) const=0

◆ computeResidualTag()

void NonlinearSystemBase::computeResidualTag ( NumericVector< Number > &  residual,
TagID  tag_id 
)
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 808 of file NonlinearSystemBase.C.

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

809 {
810  _nl_vector_tags.clear();
811  _nl_vector_tags.insert(tag_id);
813 
815 
817 
819 }
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:982
void computeResidualTags(const std::set< TagID > &tags)
Form multiple tag-associated residual vectors for all the given tags.
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
TagID residualVectorTag() const override

◆ computeResidualTags()

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

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

Definition at line 830 of file NonlinearSystemBase.C.

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

831 {
832  parallel_object_only();
833 
834  TIME_SECTION("nl::computeResidualTags", 5);
835 
838 
839  bool required_residual = tags.find(residualVectorTag()) == tags.end() ? false : true;
840 
842 
843  // not suppose to do anythin on matrix
845 
847 
848  for (const auto & numeric_vec : _vecs_to_zero_for_residual)
849  if (hasVector(numeric_vec))
850  {
851  NumericVector<Number> & vec = getVector(numeric_vec);
852  vec.close();
853  vec.zero();
854  }
855 
856  try
857  {
858  zeroTaggedVectors(tags);
860  closeTaggedVectors(tags);
861 
862  if (required_residual)
863  {
864  auto & residual = getVector(residualVectorTag());
865  if (!_time_integrators.empty())
866  {
867  for (auto & ti : _time_integrators)
868  ti->postResidual(residual);
869  }
870  else
871  residual += *_Re_non_time;
872  residual.close();
873  }
875  // We don't want to do nodal bcs or anything else
876  return;
877 
879  closeTaggedVectors(tags);
880 
881  // If we are debugging residuals we need one more assignment to have the ghosted copy up to
882  // date
883  if (_need_residual_ghosted && _debugging_residuals && required_residual)
884  {
885  auto & residual = getVector(residualVectorTag());
886 
887  *_residual_ghosted = residual;
889  }
890  // Need to close and update the aux system in case residuals were saved to it.
893  if (hasSaveIn())
895  }
896  catch (MooseException & e)
897  {
898  // The buck stops here, we have already handled the exception by
899  // calling stopSolve(), it is now up to PETSc to return a
900  // "diverged" reason during the next solve.
901  }
902 
903  // not supposed to do anything on matrix
905 
907 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049
void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
Definition: SystemBase.C:694
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:925
bool _debugging_residuals
true if debugging residuals
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
NumericVector< Number > & solution()
Definition: SystemBase.h:197
void setCurrentlyComputingResidual(bool currently_computing_residual) final
Set whether or not the problem is in the process of computing the residual.
bool _has_nodalbc_save_in
If there is a nodal BC having save_in.
Scope guard for starting and stopping Floating Point Exception Trapping.
virtual void zero()=0
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1244
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
virtual void activateAllMatrixTags()
Make all existing matrices active.
Definition: SystemBase.C:1132
virtual void deactivateAllMatrixTags()
Make matrices inactive.
Definition: SystemBase.C:1120
void computeNodalBCsResidual(NumericVector< Number > &residual)
Enforces nodal boundary conditions.
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
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
AuxiliarySystem & getAuxiliarySystem()
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:668
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:988
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
Provides a way for users to bail out of the current solve.
unsigned int _n_residual_evaluations
Total number of residual evaluations that have been performed.
bool hasSaveIn() const
Weather or not the nonlinear system has save-ins.
NumericVector< Number > * _residual_ghosted
ghosted form of the residual
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:934

◆ computeScalarKernelsJacobians()

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

Definition at line 2904 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

2905 {
2906  MooseObjectWarehouse<ScalarKernelBase> * scalar_kernel_warehouse;
2907 
2908  if (!tags.size() || tags.size() == _fe_problem.numMatrixTags())
2909  scalar_kernel_warehouse = &_scalar_kernels;
2910  else if (tags.size() == 1)
2911  scalar_kernel_warehouse = &(_scalar_kernels.getMatrixTagObjectWarehouse(*(tags.begin()), 0));
2912  else
2913  scalar_kernel_warehouse = &(_scalar_kernels.getMatrixTagsObjectWarehouse(tags, 0));
2914 
2915  // Compute the diagonal block for scalar variables
2916  if (scalar_kernel_warehouse->hasActiveObjects())
2917  {
2918  const auto & scalars = scalar_kernel_warehouse->getActiveObjects();
2919 
2920  _fe_problem.reinitScalars(/*tid=*/0);
2921 
2922  _fe_problem.reinitOffDiagScalars(/*_tid*/ 0);
2923 
2924  bool have_scalar_contributions = false;
2925  for (const auto & kernel : scalars)
2926  {
2927  if (!kernel->computesJacobian())
2928  continue;
2929 
2930  kernel->reinit();
2931  const std::vector<dof_id_type> & dof_indices = kernel->variable().dofIndices();
2932  const DofMap & dof_map = kernel->variable().dofMap();
2933  const dof_id_type first_dof = dof_map.first_dof();
2934  const dof_id_type end_dof = dof_map.end_dof();
2935  for (dof_id_type dof : dof_indices)
2936  {
2937  if (dof >= first_dof && dof < end_dof)
2938  {
2939  kernel->computeJacobian();
2940  _fe_problem.addJacobianOffDiagScalar(kernel->variable().number());
2941  have_scalar_contributions = true;
2942  break;
2943  }
2944  }
2945  }
2946 
2947  if (have_scalar_contributions)
2949  }
2950 }
dof_id_type end_dof(const processor_id_type proc) const
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
virtual void addJacobianOffDiagScalar(unsigned int ivar, const THREAD_ID tid=0)
const Variable & variable(const unsigned int c) const override
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
MooseObjectWarehouse< T > & getMatrixTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given matrix tag...
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:248
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
bool hasActiveObjects(THREAD_ID tid=0) const
MooseObjectWarehouse< T > & getMatrixTagsObjectWarehouse(const std::set< TagID > &tags, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has one of the given matrix tags...
dof_id_type first_dof(const processor_id_type proc) const
virtual void reinitOffDiagScalars(const THREAD_ID tid) override
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
uint8_t dof_id_type
virtual void addJacobianScalar(const THREAD_ID tid=0)

◆ computeScaling()

bool NonlinearSystemBase::computeScaling ( )
inherited

Method used to obtain scaling factors for variables.

Returns
whether this method ran without exceptions

Definition at line 4055 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::preSolve().

4056 {
4058  return true;
4059 
4060  _console << "\nPerforming automatic scaling calculation\n" << std::endl;
4061 
4062  TIME_SECTION("computeScaling", 3, "Computing Automatic Scaling");
4063 
4064  // It's funny but we need to assemble our vector of scaling factors here otherwise we will be
4065  // applying scaling factors of 0 during Assembly of our scaling Jacobian
4067 
4068  // container for repeated access of element global dof indices
4069  std::vector<dof_id_type> dof_indices;
4070 
4071  if (!_auto_scaling_initd)
4072  setupScalingData();
4073 
4074  std::vector<Real> inverse_scaling_factors(_num_scaling_groups, 0);
4075  std::vector<Real> resid_inverse_scaling_factors(_num_scaling_groups, 0);
4076  std::vector<Real> jac_inverse_scaling_factors(_num_scaling_groups, 0);
4077  auto & dof_map = dofMap();
4078 
4079  // what types of scaling do we want?
4080  bool jac_scaling = _resid_vs_jac_scaling_param < 1. - TOLERANCE;
4081  bool resid_scaling = _resid_vs_jac_scaling_param > TOLERANCE;
4082 
4083  const NumericVector<Number> & scaling_residual = RHS();
4084 
4085  if (jac_scaling)
4086  {
4087  // if (!_auto_scaling_initd)
4088  // We need to reinit this when the number of dofs changes
4089  // but there is no good way to track that
4090  // In theory, it is the job of libmesh system to track this,
4091  // but this special matrix is not owned by libMesh system
4092  // Let us reinit eveytime since it is not expensive
4093  {
4094  auto init_vector = NumericVector<Number>::build(this->comm());
4095  init_vector->init(system().n_dofs(), system().n_local_dofs(), /*fast=*/false, PARALLEL);
4096 
4097  _scaling_matrix->clear();
4098  _scaling_matrix->init(*init_vector);
4099  }
4100 
4102  // Dispatch to derived classes to ensure that we use the correct matrix tag
4105  }
4106 
4107  if (resid_scaling)
4108  {
4111  // Dispatch to derived classes to ensure that we use the correct vector tag
4115  }
4116 
4117  // Did something bad happen during residual/Jacobian scaling computation?
4119  return false;
4120 
4121  auto examine_dof_indices = [this,
4122  jac_scaling,
4123  resid_scaling,
4124  &dof_map,
4125  &jac_inverse_scaling_factors,
4126  &resid_inverse_scaling_factors,
4127  &scaling_residual](const auto & dof_indices, const auto var_number)
4128  {
4129  for (auto dof_index : dof_indices)
4130  if (dof_map.local_index(dof_index))
4131  {
4132  if (jac_scaling)
4133  {
4134  // For now we will use the diagonal for determining scaling
4135  auto mat_value = (*_scaling_matrix)(dof_index, dof_index);
4136  auto & factor = jac_inverse_scaling_factors[_var_to_group_var[var_number]];
4137  factor = std::max(factor, std::abs(mat_value));
4138  }
4139  if (resid_scaling)
4140  {
4141  auto vec_value = scaling_residual(dof_index);
4142  auto & factor = resid_inverse_scaling_factors[_var_to_group_var[var_number]];
4143  factor = std::max(factor, std::abs(vec_value));
4144  }
4145  }
4146  };
4147 
4148  // Compute our scaling factors for the spatial field variables
4149  for (const auto & elem : _fe_problem.getCurrentAlgebraicElementRange())
4150  for (const auto i : make_range(system().n_vars()))
4152  {
4153  dof_map.dof_indices(elem, dof_indices, i);
4154  examine_dof_indices(dof_indices, i);
4155  }
4156 
4157  for (const auto i : make_range(system().n_vars()))
4158  if (_variable_autoscaled[i] && system().variable_type(i).family == SCALAR)
4159  {
4160  dof_map.SCALAR_dof_indices(dof_indices, i);
4161  examine_dof_indices(dof_indices, i);
4162  }
4163 
4164  if (resid_scaling)
4165  _communicator.max(resid_inverse_scaling_factors);
4166  if (jac_scaling)
4167  _communicator.max(jac_inverse_scaling_factors);
4168 
4169  if (jac_scaling && resid_scaling)
4170  for (MooseIndex(inverse_scaling_factors) i = 0; i < inverse_scaling_factors.size(); ++i)
4171  {
4172  // Be careful not to take log(0)
4173  if (!resid_inverse_scaling_factors[i])
4174  {
4175  if (!jac_inverse_scaling_factors[i])
4176  inverse_scaling_factors[i] = 1;
4177  else
4178  inverse_scaling_factors[i] = jac_inverse_scaling_factors[i];
4179  }
4180  else if (!jac_inverse_scaling_factors[i])
4181  // We know the resid is not zero
4182  inverse_scaling_factors[i] = resid_inverse_scaling_factors[i];
4183  else
4184  inverse_scaling_factors[i] =
4185  std::exp(_resid_vs_jac_scaling_param * std::log(resid_inverse_scaling_factors[i]) +
4186  (1 - _resid_vs_jac_scaling_param) * std::log(jac_inverse_scaling_factors[i]));
4187  }
4188  else if (jac_scaling)
4189  inverse_scaling_factors = jac_inverse_scaling_factors;
4190  else if (resid_scaling)
4191  inverse_scaling_factors = resid_inverse_scaling_factors;
4192  else
4193  mooseError("We shouldn't be calling this routine if we're not performing any scaling");
4194 
4195  // We have to make sure that our scaling values are not zero
4196  for (auto & scaling_factor : inverse_scaling_factors)
4197  if (scaling_factor == 0)
4198  scaling_factor = 1;
4199 
4200  // Now flatten the group scaling factors to the individual variable scaling factors
4201  std::vector<Real> flattened_inverse_scaling_factors(system().n_vars());
4202  for (const auto i : index_range(flattened_inverse_scaling_factors))
4203  flattened_inverse_scaling_factors[i] = inverse_scaling_factors[_var_to_group_var[i]];
4204 
4205  // Now set the scaling factors for the variables
4206  applyScalingFactors(flattened_inverse_scaling_factors);
4208  displaced_problem->systemBaseNonlinear(number()).applyScalingFactors(
4209  flattened_inverse_scaling_factors);
4210 
4211  _computed_scaling = true;
4212  return true;
4213 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:50
std::vector< bool > _variable_autoscaled
Container to hold flag if variable is to participate in autoscaling.
std::shared_ptr< DisplacedProblem > displaced_problem
void applyScalingFactors(const std::vector< Real > &inverse_scaling_factors)
Applies scaling factors to the system&#39;s variables.
Definition: SystemBase.C:1497
SCALAR
auto exp(const T &)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
const Parallel::Communicator & comm() const
std::unique_ptr< libMesh::DiagonalMatrix< Number > > _scaling_matrix
A diagonal matrix used for computing scaling.
const Parallel::Communicator & _communicator
const libMesh::ConstElemRange & getCurrentAlgebraicElementRange()
These are the element and nodes that contribute to the jacobian and residual for this local processor...
std::size_t _num_scaling_groups
The number of scaling groups.
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we&#39;re computing the scaling jacobian.
bool _compute_scaling_once
Whether the scaling factors should only be computed once at the beginning of the simulation through a...
auto max(const L &left, const R &right)
Real _resid_vs_jac_scaling_param
The param that indicates the weighting of the residual vs the Jacobian in determining variable scalin...
bool _auto_scaling_initd
Whether we&#39;ve initialized the automatic scaling data structures.
virtual void computeScalingResidual()=0
Compute a "residual" for automatic scaling purposes.
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:1164
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:1158
void setupScalingData()
Setup group scaling containers.
auto log(const T &)
void computingNonlinearResid(bool computing_nonlinear_residual) final
Set whether or not the problem is in the process of computing the nonlinear residual.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual NumericVector< Number > & RHS()=0
const FEType & variable_type(const unsigned int i) const
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
void max(const T &r, T &o, Request &req) const
bool getFailNextNonlinearConvergenceCheck() const
Whether it will skip further residual evaluations and fail the next nonlinear convergence check(s) ...
IntRange< T > make_range(T beg, T end)
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
bool _computed_scaling
Flag used to indicate whether we have already computed the scaling Jacobian.
auto index_range(const T &sizable)
void assembleScalingVector()
Assemble the numeric vector of scaling factors such that it can be used during assembly of the system...
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ computeScalingJacobian()

void NonlinearSystem::computeScalingJacobian ( )
overrideprotectedvirtualinherited

Compute a "Jacobian" for automatic scaling purposes.

Implements NonlinearSystemBase.

Definition at line 360 of file NonlinearSystem.C.

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

◆ computeScalingOnce() [1/2]

bool NonlinearSystemBase::computeScalingOnce ( ) const
inlineinherited

Definition at line 719 of file NonlinearSystemBase.h.

719 { 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 720 of file NonlinearSystemBase.h.

721  {
722  _compute_scaling_once = compute_scaling_once;
723  }
bool _compute_scaling_once
Whether the scaling factors should only be computed once at the beginning of the simulation through a...

◆ computeScalingResidual()

void NonlinearSystem::computeScalingResidual ( )
overrideprotectedvirtualinherited

Compute a "residual" for automatic scaling purposes.

Implements NonlinearSystemBase.

Definition at line 366 of file NonlinearSystem.C.

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

◆ computeVariables()

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

Definition at line 872 of file SystemBase.h.

872 {}

◆ computingPreSMOResidual()

bool NonlinearSystemBase::computingPreSMOResidual ( )
inlineinherited

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

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

Definition at line 97 of file NonlinearSystemBase.h.

◆ computingScalingJacobian()

bool SystemBase::computingScalingJacobian ( ) const
inherited

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

Definition at line 1554 of file SystemBase.C.

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

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

◆ constraintJacobians()

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

Add jacobian contributions from Constraints.

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

Definition at line 2493 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

2495 {
2496  if (!hasMatrix(systemMatrixTag()))
2497  mooseError("A system matrix is required");
2498 
2499  auto & jacobian = getMatrix(systemMatrixTag());
2500 
2502  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2503  MAT_NEW_NONZERO_ALLOCATION_ERR,
2504  PETSC_FALSE));
2506  LibmeshPetscCall(MatSetOption(
2507  static_cast<PetscMatrix<Number> &>(jacobian).mat(), MAT_IGNORE_ZERO_ENTRIES, PETSC_TRUE));
2508 
2509  std::vector<numeric_index_type> zero_rows;
2510 
2511  if (displaced)
2512  mooseAssert(_fe_problem.getDisplacedProblem(),
2513  "If we're calling this method with displaced = true, then we better well have a "
2514  "displaced problem");
2515  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
2516  : static_cast<SubProblem &>(_fe_problem);
2517  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
2518 
2519  bool constraints_applied;
2521  constraints_applied = false;
2522  for (const auto & it : penetration_locators)
2523  {
2525  {
2526  // Reset the constraint_applied flag before each new constraint, as they need to be
2527  // assembled separately
2528  constraints_applied = false;
2529  }
2530  PenetrationLocator & pen_loc = *(it.second);
2531 
2532  std::vector<dof_id_type> & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
2533 
2534  BoundaryID secondary_boundary = pen_loc._secondary_boundary;
2535  BoundaryID primary_boundary = pen_loc._primary_boundary;
2536 
2537  zero_rows.clear();
2538  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, displaced))
2539  {
2540  const auto & constraints =
2541  _constraints.getActiveNodeFaceConstraints(secondary_boundary, displaced);
2542 
2543  for (const auto & secondary_node_num : secondary_nodes)
2544  {
2545  Node & secondary_node = _mesh.nodeRef(secondary_node_num);
2546 
2547  if (secondary_node.processor_id() == processor_id())
2548  {
2549  if (pen_loc._penetration_info[secondary_node_num])
2550  {
2551  PenetrationInfo & info = *pen_loc._penetration_info[secondary_node_num];
2552 
2553  reinitNodeFace(secondary_node, secondary_boundary, info, displaced);
2555 
2556  for (const auto & nfc : constraints)
2557  {
2558  if (nfc->isExplicitConstraint())
2559  continue;
2560  // Return if this constraint does not correspond to the primary-secondary pair
2561  // prepared by the outer loops.
2562  // This continue statement is required when, e.g. one secondary surface constrains
2563  // more than one primary surface.
2564  if (nfc->secondaryBoundary() != secondary_boundary ||
2565  nfc->primaryBoundary() != primary_boundary)
2566  continue;
2567 
2568  nfc->_jacobian = &jacobian_to_view;
2569 
2570  if (nfc->shouldApply())
2571  {
2572  constraints_applied = true;
2573 
2574  nfc->prepareShapes(nfc->variable().number());
2575  nfc->prepareNeighborShapes(nfc->variable().number());
2576 
2577  nfc->computeJacobian();
2578 
2579  if (nfc->overwriteSecondaryJacobian())
2580  {
2581  // Add this variable's dof's row to be zeroed
2582  zero_rows.push_back(nfc->variable().nodalDofIndex());
2583  }
2584 
2585  std::vector<dof_id_type> secondary_dofs(1, nfc->variable().nodalDofIndex());
2586 
2587  // Assume that if the user is overwriting the secondary Jacobian, then they are
2588  // supplying Jacobians that do not correspond to their other physics
2589  // (e.g. Kernels), hence we should not apply a scalingFactor that is normally
2590  // based on the order of their other physics (e.g. Kernels)
2591  Real scaling_factor =
2592  nfc->overwriteSecondaryJacobian() ? 1. : nfc->variable().scalingFactor();
2593 
2594  // Cache the jacobian block for the secondary side
2595  nfc->addJacobian(_fe_problem.assembly(0, number()),
2596  nfc->_Kee,
2597  secondary_dofs,
2598  nfc->_connected_dof_indices,
2599  scaling_factor);
2600 
2601  // Cache Ken, Kne, Knn
2602  if (nfc->addCouplingEntriesToJacobian())
2603  {
2604  // Make sure we use a proper scaling factor (e.g. don't use an interior scaling
2605  // factor when we're overwriting secondary stuff)
2606  nfc->addJacobian(_fe_problem.assembly(0, number()),
2607  nfc->_Ken,
2608  secondary_dofs,
2609  nfc->primaryVariable().dofIndicesNeighbor(),
2610  scaling_factor);
2611 
2612  // Use _connected_dof_indices to get all the correct columns
2613  nfc->addJacobian(_fe_problem.assembly(0, number()),
2614  nfc->_Kne,
2615  nfc->primaryVariable().dofIndicesNeighbor(),
2616  nfc->_connected_dof_indices,
2617  nfc->primaryVariable().scalingFactor());
2618 
2619  // We've handled Ken and Kne, finally handle Knn
2621  }
2622 
2623  // Do the off-diagonals next
2624  const std::vector<MooseVariableFEBase *> coupled_vars = nfc->getCoupledMooseVars();
2625  for (const auto & jvar : coupled_vars)
2626  {
2627  // Only compute jacobians for nonlinear variables
2628  if (jvar->kind() != Moose::VAR_SOLVER)
2629  continue;
2630 
2631  // Only compute Jacobian entries if this coupling is being used by the
2632  // preconditioner
2633  if (nfc->variable().number() == jvar->number() ||
2635  nfc->variable().number(), jvar->number(), this->number()))
2636  continue;
2637 
2638  // Need to zero out the matrices first
2640 
2641  nfc->prepareShapes(nfc->variable().number());
2642  nfc->prepareNeighborShapes(jvar->number());
2643 
2644  nfc->computeOffDiagJacobian(jvar->number());
2645 
2646  // Cache the jacobian block for the secondary side
2647  nfc->addJacobian(_fe_problem.assembly(0, number()),
2648  nfc->_Kee,
2649  secondary_dofs,
2650  nfc->_connected_dof_indices,
2651  scaling_factor);
2652 
2653  // Cache Ken, Kne, Knn
2654  if (nfc->addCouplingEntriesToJacobian())
2655  {
2656  // Make sure we use a proper scaling factor (e.g. don't use an interior scaling
2657  // factor when we're overwriting secondary stuff)
2658  nfc->addJacobian(_fe_problem.assembly(0, number()),
2659  nfc->_Ken,
2660  secondary_dofs,
2661  jvar->dofIndicesNeighbor(),
2662  scaling_factor);
2663 
2664  // Use _connected_dof_indices to get all the correct columns
2665  nfc->addJacobian(_fe_problem.assembly(0, number()),
2666  nfc->_Kne,
2667  nfc->variable().dofIndicesNeighbor(),
2668  nfc->_connected_dof_indices,
2669  nfc->variable().scalingFactor());
2670 
2671  // We've handled Ken and Kne, finally handle Knn
2673  }
2674  }
2675  }
2676  }
2677  }
2678  }
2679  }
2680  }
2682  {
2683  // See if constraints were applied anywhere
2684  _communicator.max(constraints_applied);
2685 
2686  if (constraints_applied)
2687  {
2688  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2689  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2690  PETSC_TRUE));
2691 
2692  jacobian.close();
2693  jacobian.zero_rows(zero_rows, 0.0);
2694  jacobian.close();
2696  jacobian.close();
2697  }
2698  }
2699  }
2701  {
2702  // See if constraints were applied anywhere
2703  _communicator.max(constraints_applied);
2704 
2705  if (constraints_applied)
2706  {
2707  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2708  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2709  PETSC_TRUE));
2710 
2711  jacobian.close();
2712  jacobian.zero_rows(zero_rows, 0.0);
2713  jacobian.close();
2715  jacobian.close();
2716  }
2717  }
2718 
2719  THREAD_ID tid = 0;
2720  // go over element-element constraint interface
2721  const auto & element_pair_locators = subproblem.geomSearchData()._element_pair_locators;
2722  for (const auto & it : element_pair_locators)
2723  {
2724  ElementPairLocator & elem_pair_loc = *(it.second);
2725 
2726  if (_constraints.hasActiveElemElemConstraints(it.first, displaced))
2727  {
2728  // ElemElemConstraint objects
2729  const auto & element_constraints =
2730  _constraints.getActiveElemElemConstraints(it.first, displaced);
2731 
2732  // go over pair elements
2733  const std::list<std::pair<const Elem *, const Elem *>> & elem_pairs =
2734  elem_pair_loc.getElemPairs();
2735  for (const auto & pr : elem_pairs)
2736  {
2737  const Elem * elem1 = pr.first;
2738  const Elem * elem2 = pr.second;
2739 
2740  if (elem1->processor_id() != processor_id())
2741  continue;
2742 
2743  const ElementPairInfo & info = elem_pair_loc.getElemPairInfo(pr);
2744 
2745  // for each element process constraints on the
2746  for (const auto & ec : element_constraints)
2747  {
2748  _fe_problem.setCurrentSubdomainID(elem1, tid);
2749  subproblem.reinitElemPhys(elem1, info._elem1_constraint_q_point, tid);
2750  _fe_problem.setNeighborSubdomainID(elem2, tid);
2751  subproblem.reinitNeighborPhys(elem2, info._elem2_constraint_q_point, tid);
2752 
2753  ec->prepareShapes(ec->variable().number());
2754  ec->prepareNeighborShapes(ec->variable().number());
2755 
2756  ec->reinit(info);
2757  ec->computeJacobian();
2760  }
2762  }
2763  }
2764  }
2765 
2766  // go over NodeElemConstraints
2767  std::set<dof_id_type> unique_secondary_node_ids;
2768  constraints_applied = false;
2769  for (const auto & secondary_id : _mesh.meshSubdomains())
2770  {
2771  for (const auto & primary_id : _mesh.meshSubdomains())
2772  {
2773  if (_constraints.hasActiveNodeElemConstraints(secondary_id, primary_id, displaced))
2774  {
2775  const auto & constraints =
2776  _constraints.getActiveNodeElemConstraints(secondary_id, primary_id, displaced);
2777 
2778  // get unique set of ids of all nodes on current block
2779  unique_secondary_node_ids.clear();
2780  const MeshBase & meshhelper = _mesh.getMesh();
2781  for (const auto & elem : as_range(meshhelper.active_subdomain_elements_begin(secondary_id),
2782  meshhelper.active_subdomain_elements_end(secondary_id)))
2783  {
2784  for (auto & n : elem->node_ref_range())
2785  unique_secondary_node_ids.insert(n.id());
2786  }
2787 
2788  for (auto secondary_node_id : unique_secondary_node_ids)
2789  {
2790  const Node & secondary_node = _mesh.nodeRef(secondary_node_id);
2791  // check if secondary node is on current processor
2792  if (secondary_node.processor_id() == processor_id())
2793  {
2794  // This reinits the variables that exist on the secondary node
2795  _fe_problem.reinitNodeFace(&secondary_node, secondary_id, 0);
2796 
2797  // This will set aside residual and jacobian space for the variables that have dofs
2798  // on the secondary node
2801 
2802  for (const auto & nec : constraints)
2803  {
2804  if (nec->shouldApply())
2805  {
2806  constraints_applied = true;
2807 
2808  nec->_jacobian = &jacobian_to_view;
2809  nec->prepareShapes(nec->variable().number());
2810  nec->prepareNeighborShapes(nec->variable().number());
2811 
2812  nec->computeJacobian();
2813 
2814  if (nec->overwriteSecondaryJacobian())
2815  {
2816  // Add this variable's dof's row to be zeroed
2817  zero_rows.push_back(nec->variable().nodalDofIndex());
2818  }
2819 
2820  std::vector<dof_id_type> secondary_dofs(1, nec->variable().nodalDofIndex());
2821 
2822  // Cache the jacobian block for the secondary side
2823  nec->addJacobian(_fe_problem.assembly(0, number()),
2824  nec->_Kee,
2825  secondary_dofs,
2826  nec->_connected_dof_indices,
2827  nec->variable().scalingFactor());
2828 
2829  // Cache the jacobian block for the primary side
2830  nec->addJacobian(_fe_problem.assembly(0, number()),
2831  nec->_Kne,
2832  nec->primaryVariable().dofIndicesNeighbor(),
2833  nec->_connected_dof_indices,
2834  nec->primaryVariable().scalingFactor());
2835 
2838 
2839  // Do the off-diagonals next
2840  const std::vector<MooseVariableFEBase *> coupled_vars = nec->getCoupledMooseVars();
2841  for (const auto & jvar : coupled_vars)
2842  {
2843  // Only compute jacobians for nonlinear variables
2844  if (jvar->kind() != Moose::VAR_SOLVER)
2845  continue;
2846 
2847  // Only compute Jacobian entries if this coupling is being used by the
2848  // preconditioner
2849  if (nec->variable().number() == jvar->number() ||
2851  nec->variable().number(), jvar->number(), this->number()))
2852  continue;
2853 
2854  // Need to zero out the matrices first
2856 
2857  nec->prepareShapes(nec->variable().number());
2858  nec->prepareNeighborShapes(jvar->number());
2859 
2860  nec->computeOffDiagJacobian(jvar->number());
2861 
2862  // Cache the jacobian block for the secondary side
2863  nec->addJacobian(_fe_problem.assembly(0, number()),
2864  nec->_Kee,
2865  secondary_dofs,
2866  nec->_connected_dof_indices,
2867  nec->variable().scalingFactor());
2868 
2869  // Cache the jacobian block for the primary side
2870  nec->addJacobian(_fe_problem.assembly(0, number()),
2871  nec->_Kne,
2872  nec->variable().dofIndicesNeighbor(),
2873  nec->_connected_dof_indices,
2874  nec->variable().scalingFactor());
2875 
2878  }
2879  }
2880  }
2881  }
2882  }
2883  }
2884  }
2885  }
2886  // See if constraints were applied anywhere
2887  _communicator.max(constraints_applied);
2888 
2889  if (constraints_applied)
2890  {
2891  LibmeshPetscCall(MatSetOption(static_cast<PetscMatrix<Number> &>(jacobian).mat(),
2892  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
2893  PETSC_TRUE));
2894 
2895  jacobian.close();
2896  jacobian.zero_rows(zero_rows, 0.0);
2897  jacobian.close();
2899  jacobian.close();
2900  }
2901 }
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:311
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:361
const Parallel::Communicator & _communicator
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
bool hasActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
const std::vector< std::shared_ptr< NodeElemConstraintBase > > & getActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
virtual void cacheJacobianNeighbor(const THREAD_ID tid) override
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:834
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
std::vector< dof_id_type > _secondary_nodes
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3575
const ElementPairList & getElemPairs() const
boundary_id_type BoundaryID
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
SubProblem & subproblem()
Definition: SystemBase.h:102
bool errorOnJacobianNonzeroReallocation() const
Will return True if the user wants to get an error when a nonzero is reallocated in the Jacobian by P...
This is the ElementPairLocator class.
This is the ElementPairInfo class.
std::map< BoundaryID, std::shared_ptr< ElementPairLocator > > _element_pair_locators
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
virtual GeometricSearchData & geomSearchData()=0
virtual void prepareAssembly(const THREAD_ID tid) override
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual void reinitElemPhys(const Elem *elem, const std::vector< Point > &phys_points_in_elem, const THREAD_ID tid)=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseMesh & _mesh
Definition: SystemBase.h:991
void max(const T &r, T &o, Request &req) const
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025
bool hasActiveElemElemConstraints(const InterfaceID interface_id, bool displaced) const
void reinitNodeFace(const Node &secondary_node, const BoundaryID secondary_boundary, const PenetrationInfo &info, const bool displaced)
Reinitialize quantities such as variables, residuals, Jacobians, materials for node-face constraints...
bool ignoreZerosInJacobian() const
Will return true if zeros in the Jacobian are to be dropped from the sparsity pattern.
processor_id_type processor_id() const
const std::vector< std::shared_ptr< ElemElemConstraint > > & getActiveElemElemConstraints(InterfaceID interface_id, bool displaced) const
virtual void cacheJacobian(const THREAD_ID tid) override
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
virtual void reinitOffDiagScalars(const THREAD_ID tid) override
processor_id_type processor_id() const
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override
BoundaryID _primary_boundary
unsigned int THREAD_ID
Definition: MooseTypes.h:237
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:3298
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 1367 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualInternal().

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

◆ containsEigenKernel()

bool MooseEigenSystem::containsEigenKernel ( ) const

Weather or not the system contains eigen kernels.

Definition at line 253 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::checkIntegrity().

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

◆ containsTimeKernel()

bool NonlinearSystemBase::containsTimeKernel ( )
overridevirtualinherited

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

Implements SolverSystem.

Definition at line 3872 of file NonlinearSystemBase.C.

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

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

◆ converged()

bool NonlinearSystem::converged ( )
overridevirtualinherited

Returns the convergence state.

Returns
true if converged, otherwise false

Implements SolverSystem.

Definition at line 337 of file NonlinearSystem.C.

338 {
340  return false;
341  // When not computing the residual (for example at the beginning of a time step),
342  // we may be in the process of counting invalid solution warnings, so the call to
343  // acceptInvalidSolution() would fail due to lack of parallel synchronization
344  // TODO: think of a better solution
346  {
347  mooseWarning("The solution is not converged due to the solution being invalid.");
348  return false;
349  }
350  return _nl_implicit_sys.nonlinear_solver->converged;
351 }
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
libMesh::NonlinearImplicitSystem & _nl_implicit_sys
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:345
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:184
bool hasSynced() const
Whether the solution invalidity has synchronized iteration counts across MPI processes.
MooseApp & _app
Definition: SystemBase.h:988
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
bool acceptInvalidSolution() const
Whether or not to accept the solution based on its invalidity.
bool getFailNextNonlinearConvergenceCheck() const
Whether it will skip further residual evaluations and fail the next nonlinear convergence check(s) ...
virtual bool hasException()
Whether or not an exception has occurred.

◆ copyOldSolutions()

void SystemBase::copyOldSolutions ( )
virtualinherited

Shifts the solutions backwards in time.

Definition at line 1287 of file SystemBase.C.

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

1288 {
1289  // copy the solutions backward: current->old, old->older
1290  const auto states =
1291  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
1292  if (states > 1)
1293  for (unsigned int i = states - 1; i > uint(_skip_next_solution_to_old_copy); --i)
1294  solutionState(i) = solutionState(i - 1);
1296 
1297  if (solutionUDotOld())
1298  *solutionUDotOld() = *solutionUDot();
1299  if (solutionUDotDotOld())
1301 }
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1433
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:265
bool _skip_next_solution_to_old_copy
Whether to skip the next copy from the solution to the old vector.
Definition: SystemBase.h:1083
virtual NumericVector< Number > * solutionUDot()
Definition: SystemBase.h:262
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:264
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079
virtual NumericVector< Number > * solutionUDotDot()
Definition: SystemBase.h:263

◆ copyPreviousFixedPointSolutions()

void SystemBase::copyPreviousFixedPointSolutions ( )
virtualinherited

Definition at line 1304 of file SystemBase.C.

1305 {
1306  const auto n_states =
1307  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::FixedPoint)]
1308  .size();
1309  if (n_states > 1)
1310  for (unsigned int i = n_states - 1; i > 0; --i)
1313 }
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:1433
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079

◆ copyPreviousNonlinearSolutions()

void SystemBase::copyPreviousNonlinearSolutions ( )
virtualinherited

Shifts the solutions backwards in nonlinear iteration history.

Definition at line 1270 of file SystemBase.C.

Referenced by SystemBase::copySolutionsBackwards().

1271 {
1272  const auto states =
1273  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Nonlinear)].size();
1274  if (states > 1)
1275  for (unsigned int i = states - 1; i > 0; --i)
1278 
1279  if (solutionPreviousNewton())
1281 }
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
Definition: SystemBase.C:1433
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079
virtual const NumericVector< Number > * solutionPreviousNewton() const
Definition: SystemBase.C:1357

◆ copySolutionsBackwards()

void SystemBase::copySolutionsBackwards ( )
virtualinherited

Copy current solution into old and older.

Definition at line 1259 of file SystemBase.C.

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

◆ copyTimeIntegrators()

void SystemBase::copyTimeIntegrators ( const SystemBase other_sys)
inherited

Copy time integrators from another system.

Definition at line 1656 of file SystemBase.C.

1657 {
1659 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049

◆ copyVars()

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

Definition at line 1184 of file SystemBase.C.

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

◆ currentSolution()

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

The solution vector that is currently being operated on.

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

Implements SystemBase.

Definition at line 135 of file SolverSystem.h.

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

136 {
137  return _current_solution;
138 }
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:120

◆ customSetup()

void NonlinearSystemBase::customSetup ( const ExecFlagType exec_type)
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 400 of file NonlinearSystemBase.C.

401 {
402  SolverSystem::customSetup(exec_type);
403 
404  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
405  {
406  _kernels.customSetup(exec_type, tid);
407  _nodal_kernels.customSetup(exec_type, tid);
408  _dirac_kernels.customSetup(exec_type, tid);
409  if (_doing_dg)
410  _dg_kernels.customSetup(exec_type, tid);
411  _interface_kernels.customSetup(exec_type, tid);
412  _element_dampers.customSetup(exec_type, tid);
413  _nodal_dampers.customSetup(exec_type, tid);
414  _integrated_bcs.customSetup(exec_type, tid);
415 
416  if (_fe_problem.haveFV())
417  {
418  std::vector<FVFluxBC *> bcs;
420  .query()
421  .template condition<AttribSystem>("FVFluxBC")
422  .template condition<AttribThread>(tid)
423  .queryInto(bcs);
424 
425  std::vector<FVInterfaceKernel *> iks;
427  .query()
428  .template condition<AttribSystem>("FVInterfaceKernel")
429  .template condition<AttribThread>(tid)
430  .queryInto(iks);
431 
432  std::vector<FVFluxKernel *> kernels;
434  .query()
435  .template condition<AttribSystem>("FVFluxKernel")
436  .template condition<AttribThread>(tid)
437  .queryInto(kernels);
438 
439  for (auto * bc : bcs)
440  bc->customSetup(exec_type);
441  for (auto * ik : iks)
442  ik->customSetup(exec_type);
443  for (auto * kernel : kernels)
444  kernel->customSetup(exec_type);
445  }
446  }
447  _scalar_kernels.customSetup(exec_type);
448  _constraints.customSetup(exec_type);
449  _general_dampers.customSetup(exec_type);
450  _nodal_bcs.customSetup(exec_type);
451  _preset_nodal_bcs.customSetup(exec_type);
453 
454 #ifdef MOOSE_KOKKOS_ENABLED
455  _kokkos_kernels.customSetup(exec_type);
458  _kokkos_nodal_bcs.customSetup(exec_type);
459 #endif
460 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_kernels
unsigned int n_threads()
MooseObjectTagWarehouse< ResidualObject > _kokkos_kernels
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:312
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)
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
TheWarehouse & theWarehouse() const
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
MooseObjectTagWarehouse< ResidualObject > _kokkos_integrated_bcs
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
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:467
virtual void customSetup(const ExecFlagType &exec_type)
Definition: SystemBase.C:1574
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:237
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ deactivateAllMatrixTags()

void SystemBase::deactivateAllMatrixTags ( )
virtualinherited

Make matrices inactive.

Definition at line 1120 of file SystemBase.C.

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

1121 {
1122  auto num_matrix_tags = _subproblem.numMatrixTags();
1123 
1124  _matrix_tag_active_flags.resize(num_matrix_tags);
1125 
1126  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1127  _matrix_tag_active_flags[tag] = false;
1128  _active_tagged_matrices.clear();
1129 }
std::unordered_map< TagID, libMesh::SparseMatrix< Number > * > _active_tagged_matrices
Active tagged matrices. A matrix is active if its tag-matrix pair is present in the map...
Definition: SystemBase.h:1025
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:1027
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:248

◆ debuggingResiduals()

void NonlinearSystemBase::debuggingResiduals ( bool  state)
inlineinherited

Definition at line 594 of file NonlinearSystemBase.h.

594 { _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 320 of file SystemBase.h.

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

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

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

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

314  {
316  }
virtual TagID timeVectorTag() const
Ideally, we should not need this API.
Definition: SystemBase.h:293
virtual TagID nonTimeVectorTag() const
Definition: SystemBase.h:303
virtual TagID residualVectorTag() const
Definition: SystemBase.h:308

◆ destroyColoring()

void NonlinearSystemBase::destroyColoring ( )
inherited

Destroy the coloring object if it exists.

Definition at line 4289 of file NonlinearSystemBase.C.

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

4290 {
4291  if (matrixFromColoring())
4292  LibmeshPetscCall(MatFDColoringDestroy(&_fdcoloring));
4293 }
virtual bool matrixFromColoring() const
Whether a system matrix is formed from coloring.
Definition: SolverSystem.h:117

◆ disassociateDefaultMatrixTags()

void SystemBase::disassociateDefaultMatrixTags ( )
virtualinherited

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

Reimplemented in DisplacedSystem.

Definition at line 1111 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultMatrixTags().

1112 {
1113  const auto tags = defaultMatrixTags();
1114  for (const auto tag : tags)
1115  if (_subproblem.matrixTagExists(tag))
1117 }
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1089
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
virtual std::set< TagID > defaultMatrixTags() const
Get the default matrix tags associted with this system.
Definition: SystemBase.h:320
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:329

◆ disassociateDefaultVectorTags()

void SystemBase::disassociateDefaultVectorTags ( )
virtualinherited

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

Reimplemented in DisplacedSystem.

Definition at line 1016 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultVectorTags().

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

◆ disassociateMatrixFromTag() [1/2]

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

Disassociate a matrix from a tag.

Reimplemented in DisplacedSystem.

Definition at line 1089 of file SystemBase.C.

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

1090 {
1091  if (!_subproblem.matrixTagExists(tag))
1092  mooseError("Cannot disassociate matrix from tag ", tag, " because that tag does not exist");
1093  if (hasMatrix(tag) && &getMatrix(tag) != &matrix)
1094  mooseError("You can not disassociate a matrix from a tag which it was not associated to");
1095 
1097 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:361
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1089
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:329

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

1101 {
1102  if (!_subproblem.matrixTagExists(tag))
1103  mooseError("Cannot disassociate matrix from tag ", tag, " because that tag does not exist");
1104 
1105  if (_tagged_matrices.size() < tag + 1)
1106  _tagged_matrices.resize(tag + 1);
1107  _tagged_matrices[tag] = nullptr;
1108 }
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:1023
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:329

◆ disassociateVectorFromTag() [1/2]

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

◆ disassociateVectorFromTag() [2/2]

void SystemBase::disassociateVectorFromTag ( TagID  tag)
virtualinherited

Disassociate any vector that is associated with a given tag.

Reimplemented in DisplacedSystem.

Definition at line 1005 of file SystemBase.C.

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

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

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

◆ doingDG()

bool NonlinearSystemBase::doingDG ( ) const
inherited

Getter for _doing_dg.

Definition at line 3947 of file NonlinearSystemBase.C.

3948 {
3949  return _doing_dg;
3950 }
bool _doing_dg
true if DG is active (optimization reasons)

◆ duDotDotDu() [1/2]

virtual Number& SystemBase::duDotDotDu ( )
inlinevirtualinherited

Reimplemented in DisplacedSystem.

Definition at line 258 of file SystemBase.h.

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

258 { return _du_dotdot_du; }
Real _du_dotdot_du
Definition: SystemBase.h:1018

◆ duDotDotDu() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 260 of file SystemBase.h.

260 { return _du_dotdot_du; }
Real _du_dotdot_du
Definition: SystemBase.h:1018

◆ duDotDu()

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

Reimplemented in DisplacedSystem.

Definition at line 1690 of file SystemBase.C.

Referenced by DisplacedSystem::duDotDu(), MooseVariableScalar::reinit(), Moose::Kokkos::VariableGradientTempl< is_ad >::VariableGradientTempl(), and Moose::Kokkos::VariableValueTempl< is_ad >::VariableValueTempl().

1691 {
1692  return _du_dot_du[var_num];
1693 }
std::vector< Real > _du_dot_du
Derivative of time derivative of u with respect to uj.
Definition: SystemBase.h:1017

◆ duDotDus()

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

Reimplemented in DisplacedSystem.

Definition at line 257 of file SystemBase.h.

Referenced by DisplacedSystem::duDotDus().

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

◆ eigenKernelOnCurrent()

void MooseEigenSystem::eigenKernelOnCurrent ( )

Definition at line 214 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::nonlinearSolve().

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

◆ eigenKernelOnOld()

void MooseEigenSystem::eigenKernelOnOld ( )

Ask eigenkernels to operate on old or current solution vectors.

Definition at line 207 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::inversePowerIteration().

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

◆ enforceNodalConstraintsJacobian()

bool NonlinearSystemBase::enforceNodalConstraintsJacobian ( const SparseMatrix< Number > &  jacobian)
protectedinherited

Enforce nodal constraints in the Jacobian.

Parameters
jacobianThe Jacobian to read from while constructing the Jacobians corresponding to the nodal constraints
Returns
Whether there were active nodal constraints

Definition at line 1132 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

1133 {
1134  if (!hasMatrix(systemMatrixTag()))
1135  mooseError(" A system matrix is required");
1136 
1137  THREAD_ID tid = 0; // constraints are going to be done single-threaded
1138 
1140  {
1141  const auto & ncs = _constraints.getActiveNodalConstraints();
1142  for (const auto & nc : ncs)
1143  {
1144  std::vector<dof_id_type> & secondary_node_ids = nc->getSecondaryNodeId();
1145  std::vector<dof_id_type> & primary_node_ids = nc->getPrimaryNodeId();
1146 
1147  if ((secondary_node_ids.size() > 0) && (primary_node_ids.size() > 0))
1148  {
1149  _fe_problem.reinitNodes(primary_node_ids, tid);
1150  _fe_problem.reinitNodesNeighbor(secondary_node_ids, tid);
1151  nc->computeJacobian(jacobian_to_view);
1152  }
1153  }
1155 
1156  return true;
1157  }
1158  else
1159  return false;
1160 }
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:311
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:361
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
unsigned int THREAD_ID
Definition: MooseTypes.h:237
virtual void addCachedJacobian(const THREAD_ID tid) override

◆ enforceNodalConstraintsResidual()

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

Enforce nodal constraints.

Definition at line 1107 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeResidualInternal().

1108 {
1109  THREAD_ID tid = 0; // constraints are going to be done single-threaded
1110  residual.close();
1112  {
1113  const auto & ncs = _constraints.getActiveNodalConstraints();
1114  for (const auto & nc : ncs)
1115  {
1116  std::vector<dof_id_type> & secondary_node_ids = nc->getSecondaryNodeId();
1117  std::vector<dof_id_type> & primary_node_ids = nc->getPrimaryNodeId();
1118 
1119  if ((secondary_node_ids.size() > 0) && (primary_node_ids.size() > 0))
1120  {
1121  _fe_problem.reinitNodes(primary_node_ids, tid);
1122  _fe_problem.reinitNodesNeighbor(secondary_node_ids, tid);
1123  nc->computeResidual(residual);
1124  }
1125  }
1126  _fe_problem.addCachedResidualDirectly(residual, tid);
1127  residual.close();
1128  }
1129 }
const std::vector< std::shared_ptr< NodalConstraint > > & getActiveNodalConstraints() const
Access methods for active objects.
virtual void reinitNodes(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
bool hasActiveNodalConstraints() const
Deterimine if active objects exist.
virtual void addCachedResidualDirectly(NumericVector< libMesh::Number > &residual, const THREAD_ID tid)
Allows for all the residual contributions that are currently cached to be added directly into the vec...
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
virtual void close()=0
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
unsigned int THREAD_ID
Definition: MooseTypes.h:237

◆ feProblem() [1/2]

FEProblemBase& SystemBase::feProblem ( )
inlineinherited

Definition at line 104 of file SystemBase.h.

Referenced by DMMooseGetEmbedding_Private(), and DMSetUp_Moose_Pre().

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

◆ feProblem() [2/2]

const FEProblemBase& SystemBase::feProblem ( ) const
inlineinherited

Definition at line 105 of file SystemBase.h.

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

◆ finalNonlinearResidual()

virtual Real NonlinearSystemBase::finalNonlinearResidual ( ) const
inlinevirtualinherited

Return the final nonlinear residual.

Reimplemented in NonlinearEigenSystem.

Definition at line 580 of file NonlinearSystemBase.h.

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

1070 {
1071  for (auto tag : tags)
1072  if (hasMatrix(tag))
1073  getMatrix(tag).flush();
1074 }
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:361
virtual void flush()
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025

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

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

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

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

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

◆ getConstraintWarehouse()

const ConstraintWarehouse& NonlinearSystemBase::getConstraintWarehouse ( ) const
inlineinherited

Definition at line 654 of file NonlinearSystemBase.h.

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

◆ getCurrentNonlinearIterationNumber()

virtual unsigned int NonlinearSystem::getCurrentNonlinearIterationNumber ( )
inlineoverridevirtualinherited

Returns the current nonlinear iteration number.

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

Implements NonlinearSystemBase.

Definition at line 45 of file NonlinearSystem.h.

46  {
48  }
libMesh::NonlinearImplicitSystem & _nl_implicit_sys
unsigned get_current_nonlinear_iteration_number() const

◆ getDGKernelWarehouse()

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

Definition at line 630 of file NonlinearSystemBase.h.

Referenced by ExplicitTimeIntegrator::initialSetup().

630 { return _dg_kernels; }
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels

◆ getDiracKernelWarehouse()

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

Definition at line 635 of file NonlinearSystemBase.h.

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

◆ getEigenVariableNames()

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

Get variable names of the eigen system.

Definition at line 94 of file MooseEigenSystem.h.

Referenced by buildSystemDoFIndices().

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

◆ getElementDamperWarehouse()

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

Definition at line 646 of file NonlinearSystemBase.h.

Referenced by ComputeElemDampingThread::printGeneralExecutionInformation().

647  {
648  return _element_dampers;
649  }
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.

◆ getFieldSplitPreconditioner()

FieldSplitPreconditionerBase & NonlinearSystemBase::getFieldSplitPreconditioner ( )
inherited
Returns
A field split preconditioner. This will error if there is no field split preconditioner

Definition at line 4296 of file NonlinearSystemBase.C.

4297 {
4298  if (!_fsp)
4299  mooseError("No field split preconditioner is present for this system");
4300 
4301  return *_fsp;
4302 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
FieldSplitPreconditionerBase * _fsp
The field split preconditioner if this sytem is using one.

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

Referenced by Marker::getMarkerValue().

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

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

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

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

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

◆ getHDGKernelWarehouse()

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

Definition at line 645 of file NonlinearSystemBase.h.

645 { return _hybridized_kernels; }
MooseObjectTagWarehouse< HDGKernel > _hybridized_kernels

◆ getIntegratedBCWarehouse() [1/2]

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

Definition at line 636 of file NonlinearSystemBase.h.

Referenced by BoundaryElemIntegrityCheckThread::operator()().

636 { return _integrated_bcs; }
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ getIntegratedBCWarehouse() [2/2]

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

Return the IntegratedBCBase warehouse.

Definition at line 664 of file NonlinearSystemBase.h.

665  {
666  return _integrated_bcs;
667  }
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs

◆ getInterfaceKernelWarehouse()

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

Definition at line 631 of file NonlinearSystemBase.h.

632  {
633  return _interface_kernels;
634  }
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels

◆ getKernelWarehouse() [1/2]

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

Access functions to Warehouses from outside NonlinearSystemBase.

Definition at line 628 of file NonlinearSystemBase.h.

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

628 { return _kernels; }
MooseObjectTagWarehouse< KernelBase > _kernels

◆ getKernelWarehouse() [2/2]

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

Definition at line 629 of file NonlinearSystemBase.h.

629 { return _kernels; }
MooseObjectTagWarehouse< KernelBase > _kernels

◆ getKokkosIntegratedBCWarehouse()

MooseObjectTagWarehouse<ResidualObject>& NonlinearSystemBase::getKokkosIntegratedBCWarehouse ( )
inlineinherited

Definition at line 681 of file NonlinearSystemBase.h.

682  {
683  return _kokkos_integrated_bcs;
684  }
MooseObjectTagWarehouse< ResidualObject > _kokkos_integrated_bcs

◆ getKokkosKernelWarehouse()

MooseObjectTagWarehouse<ResidualObject>& NonlinearSystemBase::getKokkosKernelWarehouse ( )
inlineinherited

Return the Kokkos residual object warehouses

Definition at line 672 of file NonlinearSystemBase.h.

Referenced by ExplicitTimeIntegrator::initialSetup().

672 { return _kokkos_kernels; }
MooseObjectTagWarehouse< ResidualObject > _kokkos_kernels

◆ getKokkosNodalBCWarehouse()

MooseObjectTagWarehouse<ResidualObject>& NonlinearSystemBase::getKokkosNodalBCWarehouse ( )
inlineinherited

Definition at line 677 of file NonlinearSystemBase.h.

678  {
679  return _kokkos_nodal_bcs;
680  }
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_bcs

◆ getKokkosNodalKernelWarehouse()

MooseObjectTagWarehouse<ResidualObject>& NonlinearSystemBase::getKokkosNodalKernelWarehouse ( )
inlineinherited

Definition at line 673 of file NonlinearSystemBase.h.

Referenced by ExplicitTimeIntegrator::initialSetup().

674  {
675  return _kokkos_nodal_kernels;
676  }
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_kernels

◆ getMatrix() [1/2]

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

Get a raw SparseMatrix.

Reimplemented in DisplacedSystem.

Definition at line 1025 of file SystemBase.C.

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

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

◆ getMatrix() [2/2]

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

Get a raw SparseMatrix.

Reimplemented in DisplacedSystem.

Definition at line 1043 of file SystemBase.C.

1044 {
1045  if (!hasMatrix(tag))
1046  {
1047  if (!_subproblem.matrixTagExists(tag))
1048  mooseError("Cannot retrieve matrix with tag ", tag, " because that tag does not exist");
1049  else
1050  mooseError("Cannot retrieve matrix with tag ",
1051  tag,
1052  " in system '",
1053  name(),
1054  "'\nbecause a matrix has not been associated with that tag.");
1055  }
1056 
1057  return *_tagged_matrices[tag];
1058 }
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:1023
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:361
virtual const std::string & name() const
Definition: SystemBase.C:1342
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:329

◆ getMaxVariableNumber()

unsigned int SystemBase::getMaxVariableNumber ( ) const
inlineinherited

Returns the maximum number of all variables on the system.

Definition at line 870 of file SystemBase.h.

870 { return _max_var_number; }
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:1000

◆ getMaxVarNDofsPerElem()

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

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

Returns
The max

Definition at line 586 of file SystemBase.h.

Referenced by Moose::globalDofIndexToDerivative().

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

◆ getMaxVarNDofsPerNode()

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

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

Returns
The max

Definition at line 593 of file SystemBase.h.

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

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

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

◆ getMooseKSPNormType()

Moose::MooseKSPNormType SolverSystem::getMooseKSPNormType ( )
inlineinherited

Get the norm in which the linear convergence is measured.

Definition at line 102 of file SolverSystem.h.

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

102 { return _ksp_norm; }
Moose::MooseKSPNormType _ksp_norm
KSP norm type.
Definition: SolverSystem.h:125

◆ getNodalBCWarehouse()

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

Return the NodalBCBase warehouse.

Definition at line 659 of file NonlinearSystemBase.h.

659 { return _nodal_bcs; }
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs

◆ getNodalDamperWarehouse()

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

Definition at line 650 of file NonlinearSystemBase.h.

Referenced by ComputeNodalDampingThread::printGeneralExecutionInformation().

651  {
652  return _nodal_dampers;
653  }
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.

◆ getNodalKernelWarehouse()

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

Definition at line 641 of file NonlinearSystemBase.h.

Referenced by ExplicitTimeIntegrator::initialSetup().

642  {
643  return _nodal_kernels;
644  }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.

◆ getNodeDofs()

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

Definition at line 2347 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::findImplicitGeometricCouplingEntries().

2348 {
2349  const Node & node = _mesh.nodeRef(node_id);
2350  unsigned int s = number();
2351  if (node.has_dofs(s))
2352  {
2353  for (unsigned int v = 0; v < nVariables(); v++)
2354  for (unsigned int c = 0; c < node.n_comp(s, v); c++)
2355  dofs.push_back(node.dof_number(s, v, c));
2356  }
2357 }
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
unsigned int n_comp(const unsigned int s, const unsigned int var) const
bool has_dofs(const unsigned int s=libMesh::invalid_uint) const
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:834
virtual unsigned int nVariables() const
Get the number of variables in this system.
Definition: SystemBase.C:892
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
MooseMesh & _mesh
Definition: SystemBase.h:991

◆ getPCSide()

Moose::PCSideType SolverSystem::getPCSide ( )
inlineinherited

Get the current preconditioner side.

Definition at line 91 of file SolverSystem.h.

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

91 { return _pc_side; }
Moose::PCSideType _pc_side
Preconditioning side.
Definition: SolverSystem.h:123

◆ getPreconditioner()

MoosePreconditioner const * NonlinearSystemBase::getPreconditioner ( ) const
inherited

Definition at line 3683 of file NonlinearSystemBase.C.

Referenced by ConsoleUtils::outputExecutionInformation().

3684 {
3685  return _preconditioner.get();
3686 }
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.

◆ getPredictor()

Predictor* NonlinearSystemBase::getPredictor ( )
inlineinherited

Definition at line 599 of file NonlinearSystemBase.h.

Referenced by AB2PredictorCorrector::estimateTimeError().

599 { 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 1067 of file NonlinearSystemBase.C.

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

1068 {
1069  if (!_Re_non_time)
1070  {
1072 
1073  // Most applications don't need the expense of ghosting
1075  _Re_non_time = &addVector(_Re_non_time_tag, false, ptype);
1076  }
1078  {
1079  const auto vector_name = _subproblem.vectorTagName(_Re_non_time_tag);
1080 
1081  // If an application changes its mind, the libMesh API lets us
1082  // change the vector.
1083  _Re_non_time = &system().add_vector(vector_name, false, GHOSTED);
1084  }
1085 
1086  return *_Re_non_time;
1087 }
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
PARALLEL
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:93
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
TagID _Re_non_time_tag
Tag for non-time contribution residual.
GHOSTED
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
ParallelType type() const
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:222
ParallelType
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ getResidualTimeVector()

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

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

Definition at line 1044 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::residualVector().

1045 {
1046  if (!_Re_time)
1047  {
1049 
1050  // Most applications don't need the expense of ghosting
1052  _Re_time = &addVector(_Re_time_tag, false, ptype);
1053  }
1054  else if (_need_residual_ghosted && _Re_time->type() == PARALLEL)
1055  {
1056  const auto vector_name = _subproblem.vectorTagName(_Re_time_tag);
1057 
1058  // If an application changes its mind, the libMesh API lets us
1059  // change the vector.
1060  _Re_time = &system().add_vector(vector_name, false, GHOSTED);
1061  }
1062 
1063  return *_Re_time;
1064 }
NumericVector< Number > * _Re_time
residual vector for time contributions
TagID _Re_time_tag
Tag for time contribution residual.
PARALLEL
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:93
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
GHOSTED
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
ParallelType type() const
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:222
ParallelType
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ getScalarKernelWarehouse()

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

Definition at line 637 of file NonlinearSystemBase.h.

Referenced by ExplicitTimeIntegrator::initialSetup().

638  {
639  return _scalar_kernels;
640  }
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels

◆ getScalarVariable() [1/2]

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

Gets a reference to a scalar variable with specified number.

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

Definition at line 146 of file SystemBase.C.

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

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

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

◆ getScalarVariables()

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

◆ getSNES()

SNES NonlinearSystem::getSNES ( )
overridevirtualinherited

Implements NonlinearSystemBase.

Definition at line 372 of file NonlinearSystem.C.

373 {
374  PetscNonlinearSolver<Number> * petsc_solver =
376 
377  if (petsc_solver)
378  {
379  const char * snes_prefix = nullptr;
380  std::string snes_prefix_str;
381  if (system().prefix_with_name())
382  {
383  snes_prefix_str = system().prefix();
384  snes_prefix = snes_prefix_str.c_str();
385  }
386  return petsc_solver->snes(snes_prefix);
387  }
388  else
389  mooseError("It is not a petsc nonlinear solver");
390 }
SNES snes(const char *name=nullptr)
virtual libMesh::NonlinearSolver< Number > * nonlinearSolver() override
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::string prefix() const
void prefix_with_name(bool value)
virtual libMesh::System & system() override
Get the reference to the libMesh system.

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

Referenced by FieldSplitPreconditioner::FieldSplitPreconditioner(), Split::setup(), and StaticCondensationFieldSplitPreconditioner::StaticCondensationFieldSplitPreconditioner().

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

◆ getSplits()

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

Retrieves all splits.

Definition at line 262 of file NonlinearSystemBase.h.

Referenced by ConsoleUtils::outputExecutionInformation().

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

◆ getStandardFieldVariableNames()

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

◆ getSubdomainsForVar() [1/2]

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

Definition at line 764 of file SystemBase.h.

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

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

◆ getSubdomainsForVar() [2/2]

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

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

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

Definition at line 1696 of file SystemBase.C.

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

◆ getTimeIntegrator()

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

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

Definition at line 1672 of file SystemBase.C.

Referenced by AB2PredictorCorrector::estimateTimeError().

1673 {
1674  const auto * const ti = queryTimeIntegrator(var_num);
1675 
1676  if (ti)
1677  return *ti;
1678  else
1679  mooseError("No time integrator found that integrates variable number ",
1680  std::to_string(var_num));
1681 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
const TimeIntegrator * queryTimeIntegrator(const unsigned int var_num) const
Retrieve the time integrator that integrates the given variable&#39;s equation.
Definition: SystemBase.C:1662

◆ getTimeIntegrators()

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

Definition at line 1684 of file SystemBase.C.

1685 {
1686  return _time_integrators;
1687 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049

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

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

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

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

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

◆ getVariableBlocks()

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

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

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

Definition at line 165 of file SystemBase.C.

Referenced by PhysicsBasedPreconditioner::addSystem().

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

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

845 { 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:1064

◆ getVariableNames()

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

Definition at line 863 of file SystemBase.h.

Referenced by buildSystemDoFIndices(), NonlinearSystemBase::checkKernelCoverage(), MFEMProblem::getAuxVariableNames(), SystemBase::hasVariable(), SystemBase::isArrayVariable(), and SingleMatrixPreconditioner::SingleMatrixPreconditioner().

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

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

Referenced by Assembly::addCachedResiduals(), Assembly::addResidual(), Assembly::addResidualLower(), Assembly::addResidualNeighbor(), Assembly::addResidualScalar(), NonlinearSystemBase::assembleScalingVector(), SystemBase::closeTaggedVector(), FEProblemBase::computeBounds(), FEProblemBase::computeNearNullSpace(), FEProblemBase::computeNullSpace(), NonlinearSystemBase::computeResidualAndJacobianTags(), NonlinearSystemBase::computeResidualTags(), CentralDifference::computeTimeDerivatives(), FEProblemBase::computeTransposeNullSpace(), DisplacedSystem::getVector(), Assembly::hasScalingVector(), LinearSystemContributionObject::linkTaggedVectorsAndMatrices(), SystemBase::needSolutionState(), ReferenceResidualConvergence::ReferenceResidualConvergence(), 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().

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

◆ getVector() [2/4]

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

Reimplemented in DisplacedSystem.

Definition at line 940 of file SystemBase.C.

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

◆ getVector() [3/4]

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

Get a raw NumericVector by tag.

Reimplemented in DisplacedSystem.

Definition at line 946 of file SystemBase.C.

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

◆ getVector() [4/4]

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

Reimplemented in DisplacedSystem.

Definition at line 964 of file SystemBase.C.

965 {
966  if (!hasVector(tag))
967  {
968  if (!_subproblem.vectorTagExists(tag))
969  mooseError("Cannot retrieve vector with tag ", tag, " because that tag does not exist");
970  else
971  mooseError("Cannot retrieve vector with tag ",
972  tag,
973  " in system '",
974  name(),
975  "'\nbecause a vector has not been associated with that tag.");
976  }
977 
978  return *_tagged_vectors[tag];
979 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:925
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual const std::string & name() const
Definition: SystemBase.C:1342
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:1021

◆ hasDiagSaveIn()

bool NonlinearSystemBase::hasDiagSaveIn ( ) const
inlineinherited

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

Definition at line 698 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 361 of file SystemBase.h.

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

362  {
363  return tag < _tagged_matrices.size() && _tagged_matrices[tag];
364  }
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:1023

◆ hasSaveIn()

bool NonlinearSystemBase::hasSaveIn ( ) const
inlineinherited

Weather or not the nonlinear system has save-ins.

Definition at line 693 of file NonlinearSystemBase.h.

Referenced by NonlinearSystemBase::computeResidualTags().

693 { 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 877 of file SystemBase.C.

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

878 {
879  if (system().has_variable(var_name))
880  return system().variable_type(var_name).family == SCALAR;
881  else
882  return false;
883 }
SCALAR
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const FEType & variable_type(const unsigned int i) const

◆ hasSolutionState()

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

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

Reimplemented in DisplacedSystem.

Definition at line 1087 of file SystemBase.h.

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

1089 {
1090  return _solution_states[static_cast<unsigned short>(iteration_type)].size() > state;
1091 }
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079

◆ hasVarCopy()

bool SystemBase::hasVarCopy ( ) const
inlineinherited

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

Definition at line 886 of file SystemBase.h.

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

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

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

853 {
854  auto & names = getVariableNames();
855  if (system().has_variable(var_name))
856  return system().variable_type(var_name).family != SCALAR;
857  if (std::find(names.begin(), names.end(), var_name) != names.end())
858  // array variable
859  return true;
860  else
861  return false;
862 }
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
Definition: KokkosUtils.h:40
SCALAR
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const FEType & variable_type(const unsigned int i) const
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:863

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

283  {
284  return tag_id < _tagged_vectors.size() && _tagged_vectors[tag_id];
285  }
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:1021

◆ haveFieldSplitPreconditioner()

bool NonlinearSystemBase::haveFieldSplitPreconditioner ( ) const
inlineinherited

Definition at line 112 of file NonlinearSystemBase.h.

112 { return _fsp; }
FieldSplitPreconditionerBase * _fsp
The field split preconditioner if this sytem is using one.

◆ haveFiniteDifferencedPreconditioner()

bool NonlinearSystemBase::haveFiniteDifferencedPreconditioner ( ) const
inlineinherited

Definition at line 108 of file NonlinearSystemBase.h.

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

742  {
743  _ignore_variables_for_autoscaling = ignore_variables_for_autoscaling;
744  }
std::vector< std::string > _ignore_variables_for_autoscaling
A container for variables that do not partipate in autoscaling.

◆ initializeObjects()

virtual void SystemBase::initializeObjects ( )
inlinevirtualinherited

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

Definition at line 174 of file SystemBase.h.

174 {}

◆ initialResidual()

Real NonlinearSystemBase::initialResidual ( ) const
inherited

The initial residual.

Definition at line 786 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::referenceResidual().

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

◆ initialSetup()

void NonlinearSystemBase::initialSetup ( )
overridevirtualinherited

Setup Functions.

Reimplemented from SystemBase.

Definition at line 226 of file NonlinearSystemBase.C.

227 {
228  TIME_SECTION("nlInitialSetup", 2, "Setting Up Nonlinear System");
229 
231 
232  {
233  TIME_SECTION("kernelsInitialSetup", 2, "Setting Up Kernels/BCs/Constraints");
234 
235  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
236  {
237  _kernels.initialSetup(tid);
240  if (_doing_dg)
243 
247 
248  if (_fe_problem.haveFV())
249  {
250  std::vector<FVElementalKernel *> fv_elemental_kernels;
252  .query()
253  .template condition<AttribSystem>("FVElementalKernel")
254  .template condition<AttribThread>(tid)
255  .queryInto(fv_elemental_kernels);
256 
257  for (auto * fv_kernel : fv_elemental_kernels)
258  fv_kernel->initialSetup();
259 
260  std::vector<FVFluxKernel *> fv_flux_kernels;
262  .query()
263  .template condition<AttribSystem>("FVFluxKernel")
264  .template condition<AttribThread>(tid)
265  .queryInto(fv_flux_kernels);
266 
267  for (auto * fv_kernel : fv_flux_kernels)
268  fv_kernel->initialSetup();
269  }
270  }
271 
278 
279 #ifdef MOOSE_KOKKOS_ENABLED
284 #endif
285  }
286 
287  {
288  TIME_SECTION("mortarSetup", 2, "Initializing Mortar Interfaces");
289 
290  auto create_mortar_functors = [this](const bool displaced)
291  {
292  // go over mortar interfaces and construct functors
293  const auto & mortar_interfaces = _fe_problem.getMortarInterfaces(displaced);
294  for (const auto & [primary_secondary_boundary_pair, mortar_generation_ptr] :
295  mortar_interfaces)
296  {
297  if (!_constraints.hasActiveMortarConstraints(primary_secondary_boundary_pair, displaced))
298  continue;
299 
300  auto & mortar_constraints =
301  _constraints.getActiveMortarConstraints(primary_secondary_boundary_pair, displaced);
302 
303  auto & subproblem = displaced
304  ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
305  : static_cast<SubProblem &>(_fe_problem);
306 
307  auto & mortar_functors =
309 
310  mortar_functors.emplace(primary_secondary_boundary_pair,
311  ComputeMortarFunctor(mortar_constraints,
312  *mortar_generation_ptr,
313  subproblem,
314  _fe_problem,
315  displaced,
316  subproblem.assembly(0, number())));
317  }
318  };
319 
320  create_mortar_functors(false);
321  create_mortar_functors(true);
322  }
323 
324  if (_automatic_scaling)
325  {
327  _scaling_matrix = std::make_unique<OffDiagonalScalingMatrix<Number>>(_communicator);
328  else
329  _scaling_matrix = std::make_unique<DiagonalMatrix<Number>>(_communicator);
330  }
331 
332  if (_preconditioner)
333  _preconditioner->initialSetup();
334 }
virtual void residualSetup(THREAD_ID tid=0) const
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_kernels
unsigned int n_threads()
MooseObjectTagWarehouse< ResidualObject > _kokkos_kernels
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:312
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
bool hasActiveMortarConstraints(const std::pair< BoundaryID, BoundaryID > &mortar_interface_key, bool displaced) const
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
std::unique_ptr< libMesh::DiagonalMatrix< Number > > _scaling_matrix
A diagonal matrix used for computing scaling.
const Parallel::Communicator & _communicator
std::unordered_map< std::pair< BoundaryID, BoundaryID >, ComputeMortarFunctor > _undisplaced_mortar_functors
Functors for computing undisplaced mortar constraints.
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
bool _doing_dg
true if DG is active (optimization reasons)
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
TheWarehouse & theWarehouse() const
std::unordered_map< std::pair< BoundaryID, BoundaryID >, ComputeMortarFunctor > _displaced_mortar_functors
Functors for computing displaced mortar constraints.
const std::unordered_map< std::pair< BoundaryID, BoundaryID >, std::unique_ptr< AutomaticMortarGeneration > > & getMortarInterfaces(bool on_displaced) const
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:1055
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.
SubProblem & subproblem()
Definition: SystemBase.h:102
MooseObjectTagWarehouse< KernelBase > _kernels
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
virtual void initialSetup(THREAD_ID tid=0) const
Convenience methods for calling object setup methods.
ConstraintWarehouse _constraints
Constraints storage object.
MooseObjectTagWarehouse< ResidualObject > _kokkos_integrated_bcs
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
const std::vector< std::shared_ptr< MortarConstraintBase > > & getActiveMortarConstraints(const std::pair< BoundaryID, BoundaryID > &mortar_interface_key, bool displaced) const
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:467
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num)=0
bool _off_diagonals_in_auto_scaling
Whether to include off diagonals when determining automatic scaling factors.
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
virtual void initialSetup()
Setup Functions.
Definition: SystemBase.C:1560
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:237
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ initSolutionState()

void SystemBase::initSolutionState ( )
virtualinherited

Initializes the solution state.

Reimplemented in DisplacedSystem.

Definition at line 1366 of file SystemBase.C.

Referenced by DisplacedSystem::initSolutionState().

1367 {
1368  // Default is the current solution
1369  unsigned int state = 0;
1370 
1371  // Add additional states as required by the variable states requested
1372  for (const auto & var : getVariables(/* tid = */ 0))
1373  state = std::max(state, var->oldestSolutionStateRequested());
1374  for (const auto & var : getScalarVariables(/* tid = */ 0))
1375  state = std::max(state, var->oldestSolutionStateRequested());
1376 
1378 
1380 }
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)
Definition: SystemBase.h:752
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Definition: SystemBase.h:759
bool _solution_states_initialized
Whether or not the solution states have been initialized.
Definition: SystemBase.h:1061
auto max(const L &left, const R &right)
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time, libMesh::ParallelType parallel_type=GHOSTED)
Registers that the solution state state is needed.
Definition: SystemBase.C:1452

◆ initSystemSolution()

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

Initialize the solution vector with a constant value.

Parameters
tagSystem tag.
vThe value.

Definition at line 161 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::init().

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

◆ initSystemSolutionOld()

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

Definition at line 184 of file MooseEigenSystem.C.

Referenced by EigenExecutionerBase::init().

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

◆ isArrayVariable()

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

If a variable is an array variable.

Definition at line 865 of file SystemBase.C.

866 {
867  auto & names = getVariableNames();
868  if (!system().has_variable(var_name) &&
869  std::find(names.begin(), names.end(), var_name) != names.end())
870  // array variable
871  return true;
872  else
873  return false;
874 }
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
Definition: KokkosUtils.h:40
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:863

◆ isScalarVariable()

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

Definition at line 886 of file SystemBase.C.

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

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

◆ jacobianSetup()

void NonlinearSystemBase::jacobianSetup ( )
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 2953 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::computeJacobianInternal().

2954 {
2956 
2957  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
2958  {
2959  _kernels.jacobianSetup(tid);
2962  if (_doing_dg)
2968  }
2975 
2976 #ifdef MOOSE_KOKKOS_ENABLED
2981 #endif
2982 
2983  // Avoid recursion
2984  if (this == &_fe_problem.currentNonlinearSystem())
2986 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_kernels
unsigned int n_threads()
MooseObjectTagWarehouse< ResidualObject > _kokkos_kernels
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
virtual void jacobianSetup()
Definition: SystemBase.C:1595
MooseObjectTagWarehouse< DiracKernelBase > _dirac_kernels
Dirac Kernel storage for each thread.
bool _doing_dg
true if DG is active (optimization reasons)
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
NonlinearSystemBase & currentNonlinearSystem()
MooseObjectTagWarehouse< KernelBase > _kernels
virtual void jacobianSetup(THREAD_ID tid=0) const
ConstraintWarehouse _constraints
Constraints storage object.
MooseObjectTagWarehouse< ResidualObject > _kokkos_integrated_bcs
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
void jacobianSetup() override
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:237
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ markEigenVariable()

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

Mark a variable as a variable of the eigen system.

Parameters
var_nameThe name of the variable.

Definition at line 75 of file MooseEigenSystem.C.

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

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

◆ matrixTagActive()

bool SystemBase::matrixTagActive ( TagID  tag) const
virtualinherited

If or not a matrix tag is active.

Definition at line 1150 of file SystemBase.C.

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

◆ mesh() [1/2]

MooseMesh& SystemBase::mesh ( )
inlineinherited

◆ mesh() [2/2]

const MooseMesh& SystemBase::mesh ( ) const
inlineinherited

Definition at line 101 of file SystemBase.h.

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

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

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

3963 {
3964  parallel_object_only();
3965 
3966  try
3967  {
3968  for (auto & map_pr : _undisplaced_mortar_functors)
3969  map_pr.second(compute_type, vector_tags, matrix_tags);
3970 
3971  for (auto & map_pr : _displaced_mortar_functors)
3972  map_pr.second(compute_type, vector_tags, matrix_tags);
3973  }
3974  catch (MetaPhysicL::LogicError &)
3975  {
3976  mooseError(
3977  "We caught a MetaPhysicL error in NonlinearSystemBase::mortarConstraints. This is very "
3978  "likely due to AD not having a sufficiently large derivative container size. Please run "
3979  "MOOSE configure with the '--with-derivative-size=<n>' option");
3980  }
3981 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
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

Definition at line 1342 of file SystemBase.C.

Referenced by NonlinearSystemBase::addBoundaryCondition(), NonlinearSystemBase::addConstraint(), NonlinearSystemBase::addDamper(), NonlinearSystemBase::addDGKernel(), NonlinearSystemBase::addDiracKernel(), NonlinearSystemBase::addHDGKernel(), NonlinearSystemBase::addInterfaceKernel(), addKernel(), AuxiliarySystem::addKernel(), NonlinearSystemBase::addKernel(), SystemBase::addMatrix(), NonlinearSystemBase::addNodalKernel(), Moose::PetscSupport::addPetscOptionsFromCommandline(), AuxiliarySystem::addScalarKernel(), NonlinearSystemBase::addScalarKernel(), NonlinearSystemBase::addSplit(), SystemBase::addTimeIntegrator(), AuxiliarySystem::addVariable(), SystemBase::addVariable(), DiffusionLHDGAssemblyHelper::checkCoupling(), SystemBase::closeTaggedVector(), LinearSystem::computeLinearSystemTags(), DisplacedProblem::DisplacedProblem(), SystemBase::getMatrix(), NonlinearSystemBase::getSplit(), DisplacedSystem::getVector(), SystemBase::getVector(), SystemBase::hasVector(), LinearSystem::initialSetup(), NonlinearEigenSystem::postAddResidualObject(), MooseStaticCondensationPreconditioner::prefix(), SystemBase::removeMatrix(), SystemBase::removeVector(), SystemBase::solutionState(), LinearSystem::solve(), LinearTimeIntegratorInterface::timeDerivativeMatrixContribution(), LinearTimeIntegratorInterface::timeDerivativeRHSContribution(), and SystemBase::zeroTaggedVector().

1343 {
1344  return system().name();
1345 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const std::string & name() const

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

3893 {
3894  // IntegratedBCs are for now the only objects we consider to be consuming
3895  // matprops on boundaries.
3896  if (_integrated_bcs.hasActiveBoundaryObjects(bnd_id, tid))
3897  for (const auto & bc : _integrated_bcs.getActiveBoundaryObjects(bnd_id, tid))
3898  if (std::static_pointer_cast<MaterialPropertyInterface>(bc)->getMaterialPropertyCalled())
3899  return true;
3900 
3901  // Thin layer heat transfer in the heat_transfer module is being used on a boundary even though
3902  // it's an interface kernel. That boundary is external, on both sides of a gap in a mesh
3904  for (const auto & ik : _interface_kernels.getActiveBoundaryObjects(bnd_id, tid))
3905  if (std::static_pointer_cast<MaterialPropertyInterface>(ik)->getMaterialPropertyCalled())
3906  return true;
3907 
3908  // Because MortarConstraints do not inherit from BoundaryRestrictable, they are not sorted
3909  // by boundary in the MooseObjectWarehouse. So for now, we return true for all boundaries
3910  // Note: constraints are not threaded at this time
3911  if (_constraints.hasActiveObjects(/*tid*/ 0))
3912  for (const auto & ct : _constraints.getActiveObjects(/*tid*/ 0))
3913  if (auto mpi = std::dynamic_pointer_cast<MaterialPropertyInterface>(ct);
3914  mpi && mpi->getMaterialPropertyCalled())
3915  return true;
3916  return false;
3917 }
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
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...
ConstraintWarehouse _constraints
Constraints storage object.
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasActiveObjects(THREAD_ID tid=0) const
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
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 3920 of file NonlinearSystemBase.C.

3921 {
3922  // InterfaceKernels are for now the only objects we consider to be consuming matprops on internal
3923  // boundaries.
3925  for (const auto & ik : _interface_kernels.getActiveBoundaryObjects(bnd_id, tid))
3926  if (std::static_pointer_cast<MaterialPropertyInterface>(ik)->getMaterialPropertyCalled())
3927  return true;
3928  return false;
3929 }
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels

◆ needInternalNeighborSideMaterial()

bool NonlinearSystemBase::needInternalNeighborSideMaterial ( 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 3932 of file NonlinearSystemBase.C.

3933 {
3934  // DGKernels are for now the only objects we consider to be consuming matprops on
3935  // internal sides.
3936  if (_dg_kernels.hasActiveBlockObjects(subdomain_id, tid))
3937  for (const auto & dg : _dg_kernels.getActiveBlockObjects(subdomain_id, tid))
3938  if (std::static_pointer_cast<MaterialPropertyInterface>(dg)->getMaterialPropertyCalled())
3939  return true;
3940  // NOTE:
3941  // HDG kernels do not require face material properties on internal sides at this time.
3942  // The idea is to have element locality of HDG for hybridization
3943  return false;
3944 }
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels

◆ needSolutionState()

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

Registers that the solution state state is needed.

Reimplemented in DisplacedSystem.

Definition at line 1452 of file SystemBase.C.

Referenced by SecantSolve::allocateStorage(), PicardSolve::allocateStorage(), EigenExecutionerBase::EigenExecutionerBase(), SystemBase::initSolutionState(), DisplacedSystem::needSolutionState(), SolverSystem::saveOldSolutionForFixedPointRelaxation(), and SystemBase::solutionState().

1455 {
1456  libmesh_parallel_only(this->comm());
1457  mooseAssert(!Threads::in_threads,
1458  "This routine is not thread-safe. Request the solution state before using it in "
1459  "a threaded region.");
1460 
1461  if (hasSolutionState(state, iteration_type))
1462  return;
1463 
1464  auto & solution_states = _solution_states[static_cast<unsigned short>(iteration_type)];
1465  solution_states.resize(state + 1);
1466 
1467  // The 0-th (current) solution state is owned by libMesh
1468  if (!solution_states[0])
1469  solution_states[0] = &solutionInternal();
1470  else
1471  mooseAssert(solution_states[0] == &solutionInternal(), "Inconsistent current solution");
1472 
1473  // We will manually add all states past current
1474  for (unsigned int i = 1; i <= state; ++i)
1475  if (!solution_states[i])
1476  {
1477  auto tag = _subproblem.addVectorTag(oldSolutionStateVectorName(i, iteration_type),
1479  solution_states[i] = &addVector(tag, true, parallel_type);
1480  }
1481  else
1482  {
1483  // If the existing parallel type is PARALLEL and GHOSTED is now requested,
1484  // this would require an upgrade, which is risky if anybody has already
1485  // stored a pointer to the existing vector, since the upgrade would create
1486  // a new vector and make that pointer null. If the existing parallel type
1487  // is GHOSTED and PARALLEL is now requested, we don't need to do anything.
1488  if (parallel_type == GHOSTED && solutionStateParallelType(i, iteration_type) == PARALLEL)
1489  mooseError("The solution state has already been declared as PARALLEL");
1490 
1491  mooseAssert(solution_states[i] == &getVector(oldSolutionStateVectorName(i, iteration_type)),
1492  "Inconsistent solution state");
1493  }
1494 }
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:311
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:93
const Parallel::Communicator & comm() const
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
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:1087
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:1383
libMesh::ParallelType solutionStateParallelType(const unsigned int state, const Moose::SolutionIterationType iteration_type) const
Returns the parallel type of the given solution state.
Definition: SystemBase.C:1442
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:934

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

Referenced by SystemBase::nVariables().

902 {
903  unsigned int n = 0;
904  for (auto & var : _vars[0].fieldVariables())
905  n += var->count();
906 
907  return n;
908 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

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

912 {
913  unsigned int n = 0;
914  for (auto & var : _vars[0].fieldVariables())
915  if (var->isFV())
916  n += var->count();
917 
918  return n;
919 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

◆ nLinearIterations()

virtual unsigned int NonlinearSystemBase::nLinearIterations ( ) const
inlinevirtualinherited

Return the number of linear iterations.

Reimplemented in NonlinearEigenSystem.

Definition at line 570 of file NonlinearSystemBase.h.

Referenced by IterationAdaptiveDT::acceptStep().

570 { return _n_linear_iters; }

◆ nNonlinearIterations()

virtual unsigned int NonlinearSystemBase::nNonlinearIterations ( ) const
inlinevirtualinherited

Return the number of non-linear iterations.

Reimplemented in NonlinearEigenSystem.

Definition at line 565 of file NonlinearSystemBase.h.

Referenced by IterationAdaptiveDT::acceptStep().

565 { 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 586 of file NonlinearSystemBase.h.

Referenced by Console::writeVariableNorms().

586 { return _last_nl_rnorm; }

◆ nonlinearSolver()

virtual libMesh::NonlinearSolver<Number>* NonlinearSystem::nonlinearSolver ( )
inlineoverridevirtualinherited

Implements NonlinearSystemBase.

Definition at line 60 of file NonlinearSystem.h.

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

61  {
63  }
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
libMesh::NonlinearImplicitSystem & _nl_implicit_sys

◆ nonTimeVectorTag()

TagID NonlinearSystemBase::nonTimeVectorTag ( ) const
inlineoverridevirtualinherited

Reimplemented from SystemBase.

Definition at line 710 of file NonlinearSystemBase.h.

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

710 { 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 575 of file NonlinearSystemBase.h.

575 { 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 1158 of file SystemBase.C.

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

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

◆ nVariables()

unsigned int SystemBase::nVariables ( ) const
virtualinherited

Get the number of variables in this system.

Returns
the number of variables

Definition at line 892 of file SystemBase.C.

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

893 {
894  unsigned int n = nFieldVariables();
895  n += _vars[0].scalars().size();
896 
897  return n;
898 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
unsigned int nFieldVariables() const
Get the number of field variables in this system.
Definition: SystemBase.C:901

◆ offDiagonalsInAutoScaling() [1/2]

bool NonlinearSystemBase::offDiagonalsInAutoScaling ( ) const
inlineinherited

Definition at line 746 of file NonlinearSystemBase.h.

Referenced by ComputeJacobianForScalingThread::computeOnElement().

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

◆ offDiagonalsInAutoScaling() [2/2]

void NonlinearSystemBase::offDiagonalsInAutoScaling ( bool  off_diagonals_in_auto_scaling)
inlineinherited

Definition at line 747 of file NonlinearSystemBase.h.

748  {
749  _off_diagonals_in_auto_scaling = off_diagonals_in_auto_scaling;
750  }
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 949 of file NonlinearSystemBase.C.

950 {
951  for (auto & ti : _time_integrators)
952  ti->preSolve();
953  if (_predictor.get())
954  _predictor->timestepSetup();
955 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049
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 1683 of file NonlinearSystemBase.C.

Referenced by ActuallyExplicitEuler::solve().

1684 {
1685  // Overwrite results from integrator in case we have explicit dynamics contact constraints
1687  ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1688  : static_cast<SubProblem &>(_fe_problem);
1689  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
1690 
1691  for (const auto & it : penetration_locators)
1692  {
1693  PenetrationLocator & pen_loc = *(it.second);
1694 
1695  const auto & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
1696  const BoundaryID secondary_boundary = pen_loc._secondary_boundary;
1697  const BoundaryID primary_boundary = pen_loc._primary_boundary;
1698 
1699  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, true))
1700  {
1701  const auto & constraints =
1702  _constraints.getActiveNodeFaceConstraints(secondary_boundary, true);
1703  for (const auto i : index_range(secondary_nodes))
1704  {
1705  const auto secondary_node_num = secondary_nodes[i];
1706  const Node & secondary_node = _mesh.nodeRef(secondary_node_num);
1707 
1708  if (secondary_node.processor_id() == processor_id())
1709  if (pen_loc._penetration_info[secondary_node_num])
1710  for (const auto & nfc : constraints)
1711  {
1712  if (!nfc->isExplicitConstraint())
1713  continue;
1714 
1715  // Return if this constraint does not correspond to the primary-secondary pair
1716  // prepared by the outer loops.
1717  // This continue statement is required when, e.g. one secondary surface constrains
1718  // more than one primary surface.
1719  if (nfc->secondaryBoundary() != secondary_boundary ||
1720  nfc->primaryBoundary() != primary_boundary)
1721  continue;
1722 
1723  nfc->overwriteBoundaryVariables(soln, secondary_node);
1724  }
1725  }
1726  }
1727  }
1728  soln.close();
1729 }
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:834
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
std::vector< dof_id_type > _secondary_nodes
boundary_id_type BoundaryID
SubProblem & subproblem()
Definition: SystemBase.h:102
virtual GeometricSearchData & geomSearchData()=0
virtual void close()=0
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseMesh & _mesh
Definition: SystemBase.h:991
processor_id_type processor_id() const
processor_id_type processor_id() const
auto index_range(const T &sizable)
BoundaryID _primary_boundary
NearestNodeLocator & _nearest_node

◆ perfGraph()

PerfGraph & PerfGraphInterface::perfGraph ( )
inherited

Get the PerfGraph.

Definition at line 86 of file PerfGraphInterface.C.

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

87 {
88  return _pg_moose_app.perfGraph();
89 }
MooseApp & _pg_moose_app
The MooseApp that owns the PerfGraph.
PerfGraph & perfGraph()
Get the PerfGraph for this app.
Definition: MooseApp.h:178

◆ postAddResidualObject()

virtual void NonlinearSystemBase::postAddResidualObject ( ResidualObject )
inlineprotectedvirtualinherited

◆ postInit()

virtual void SystemBase::postInit ( )
inlinevirtualinherited

Reimplemented in NonlinearEigenSystem.

Definition at line 163 of file SystemBase.h.

Referenced by NonlinearEigenSystem::postInit().

163 {}

◆ potentiallySetupFiniteDifferencing()

void NonlinearSystem::potentiallySetupFiniteDifferencing ( )
overridevirtualinherited

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

FD and/or MFFD respectively)

Reimplemented from NonlinearSystemBase.

Definition at line 125 of file NonlinearSystem.C.

Referenced by NonlinearSystem::solve().

126 {
128  {
131  }
132 
133  PetscNonlinearSolver<Real> & solver =
136 
138 }
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
libMesh::NonlinearImplicitSystem & _nl_implicit_sys
virtual void setupFiniteDifferencedPreconditioner() override
ComputeFDResidualFunctor _fd_residual_functor
bool _use_finite_differenced_preconditioner
Whether or not to use a finite differenced preconditioner.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
void set_snesmf_reuse_base(bool state)
NonlinearImplicitSystem::ComputeResidual * mffd_residual_object
bool useSNESMFReuseBase()
Return a flag that indicates if we are reusing the vector base.

◆ prefix()

std::string SystemBase::prefix ( ) const
inherited
Returns
The prefix used for this system for solver settings for PETSc. This prefix is used to prevent collision of solver settings for different systems. Note that this prefix does not have a leading dash so it's appropriate for passage straight to PETSc APIs

Definition at line 1702 of file SystemBase.C.

Referenced by FieldSplitPreconditioner::FieldSplitPreconditioner(), MoosePreconditioner::initialSetup(), and FieldSplitPreconditioner::prefix().

1703 {
1704  return system().prefix_with_name() ? system().prefix() : "";
1705 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
std::string prefix() const
void prefix_with_name(bool value)

◆ preInit()

void NonlinearSystemBase::preInit ( )
overridevirtualinherited

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

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

Reimplemented from SolverSystem.

Definition at line 191 of file NonlinearSystemBase.C.

192 {
194 
195  if (_fe_problem.hasDampers())
196  setupDampers();
197 
198  if (_residual_copy.get())
199  _residual_copy->init(_sys.n_dofs(), false, SERIAL);
200 
201 #ifdef MOOSE_KOKKOS_ENABLED
204 #endif
205 }
void setupDampers()
Setup damping stuff (called before we actually start)
bool hasDampers()
Whether or not this system has dampers.
dof_id_type n_dofs() const
SERIAL
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
std::unique_ptr< NumericVector< Number > > _residual_copy
Copy of the residual vector, or nullptr if a copy is not needed.
virtual void preInit() override
This is called prior to the libMesh system has been init&#39;d.
Definition: SolverSystem.C:32
libMesh::System & _sys
bool hasKokkosObjects() const
void full_sparsity_pattern_needed()
const DofMap & get_dof_map() const

◆ prepare()

void SystemBase::prepare ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 257 of file SystemBase.C.

Referenced by SubProblem::reinitElemFaceRef().

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

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

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

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

Referenced by SubProblem::reinitLowerDElem().

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

◆ prepareNeighbor()

void SystemBase::prepareNeighbor ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 325 of file SystemBase.C.

Referenced by SubProblem::reinitNeighborFaceRef().

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

◆ preSMOResidual()

Real NonlinearSystemBase::preSMOResidual ( ) const
inherited

The pre-SMO residual.

Definition at line 777 of file NonlinearSystemBase.C.

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

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

◆ preSolve()

bool NonlinearSystemBase::preSolve ( )
protectedinherited

Perform some steps to get ready for the solver.

These include

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

Definition at line 4263 of file NonlinearSystemBase.C.

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

4264 {
4265  // Clear the iteration counters
4266  _current_l_its.clear();
4267  _current_nl_its = 0;
4268 
4269  // Initialize the solution vector using a predictor and known values from nodal bcs
4271 
4272  // Now that the initial solution has ben set, potentially perform a residual/Jacobian evaluation
4273  // to determine variable scaling factors
4274  if (_automatic_scaling)
4275  {
4276  const bool scaling_succeeded = computeScaling();
4277  if (!scaling_succeeded)
4278  return false;
4279  }
4280 
4281  // We do not know a priori what variable a global degree of freedom corresponds to, so we need a
4282  // map from global dof to scaling factor. We just use a ghosted NumericVector for that mapping
4284 
4285  return true;
4286 }
std::vector< unsigned int > _current_l_its
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:1055
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.

Todo:
{Remove after output update

Definition at line 592 of file NonlinearSystemBase.h.

◆ queryTimeIntegrator()

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

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

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

Definition at line 1662 of file SystemBase.C.

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

1663 {
1664  for (auto & ti : _time_integrators)
1665  if (ti->integratesVar(var_num))
1666  return ti.get();
1667 
1668  return nullptr;
1669 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049

◆ referenceResidual()

Real NonlinearSystemBase::referenceResidual ( ) const
inherited

The reference residual used in relative convergence check.

Definition at line 771 of file NonlinearSystemBase.C.

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

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

◆ registerTimedSection() [1/2]

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

Call to register a named section for timing.

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

Definition at line 61 of file PerfGraphInterface.C.

63 {
64  const auto timed_section_name = timedSectionName(section_name);
65  if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
66  return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level);
67  else
68  return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
69 }
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 72 of file PerfGraphInterface.C.

76 {
77  const auto timed_section_name = timedSectionName(section_name);
78  if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
80  timedSectionName(section_name), level, live_message, print_dots);
81  else
82  return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
83 }
PerfID registerSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
std::string timedSectionName(const std::string &section_name) const
PerfID sectionID(const std::string &section_name) const
Given a name return the PerfID The name of the section.
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ reinit()

virtual void SystemBase::reinit ( )
inlinevirtualinherited

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

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

Reimplemented in NonlinearEigenSystem, LinearSystem, and AuxiliarySystem.

Definition at line 169 of file SystemBase.h.

Referenced by NonlinearEigenSystem::reinit().

169 {}

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

342 {
344  {
345  const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
347  for (const auto & var : active_elemental_moose_variables)
348  if (&(var->sys()) == this)
349  var->computeElemValues();
350  }
351  else
352  {
353  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
354  for (const auto & var : vars)
355  var->computeElemValues();
356  }
357 
358  if (system().has_static_condensation())
359  for (auto & [tag, matrix] : _active_tagged_matrices)
360  {
361  libmesh_ignore(tag);
362  cast_ptr<StaticCondensation *>(matrix)->set_current_elem(*elem);
363  }
364 }
std::unordered_map< TagID, libMesh::SparseMatrix< Number > * > _active_tagged_matrices
Active tagged matrices. A matrix is active if its tag-matrix pair is present in the map...
Definition: SystemBase.h:1025
char ** vars
virtual const std::set< MooseVariableFieldBase * > & getActiveElementalMooseVariables(const THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:455
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
void libmesh_ignore(const Args &...)
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
virtual bool hasActiveElementalMooseVariables(const THREAD_ID tid) const
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:461

◆ reinitElemFace()

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

Reinit assembly info for a side of an element.

Parameters
elemThe element
sideSide of of the element
tidThread ID

Reimplemented in AuxiliarySystem.

Definition at line 367 of file SystemBase.C.

Referenced by SubProblem::reinitElemFaceRef().

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

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

Referenced by ComputeNodalDampingThread::onNode().

3705 {
3706  for (const auto & var : damped_vars)
3707  var->computeIncrementAtNode(*_increment_vec);
3708 }
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 3695 of file NonlinearSystemBase.C.

Referenced by ComputeElemDampingThread::onElement().

3697 {
3698  for (const auto & var : damped_vars)
3699  var->computeIncrementAtQps(*_increment_vec);
3700 }
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 391 of file SystemBase.C.

Referenced by SubProblem::reinitLowerDElem().

392 {
393  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
394  for (const auto & var : vars)
395  var->computeLowerDValues();
396 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

◆ reinitMortarFunctors()

void NonlinearSystemBase::reinitMortarFunctors ( )
inherited

Update the mortar functors if the mesh has changed.

Definition at line 208 of file NonlinearSystemBase.C.

209 {
210  // reinit is called on meshChanged() in FEProblemBase. We could implement meshChanged() instead.
211  // Subdomains might have changed
212  for (auto & functor : _displaced_mortar_functors)
213  functor.second.setupMortarMaterials();
214  for (auto & functor : _undisplaced_mortar_functors)
215  functor.second.setupMortarMaterials();
216 }
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.

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

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

◆ reinitNeighborFace()

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

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

Definition at line 375 of file SystemBase.C.

Referenced by SubProblem::reinitNeighborFaceRef().

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

◆ 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 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 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

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

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

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

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

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

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

1167 {
1168  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1169  : static_cast<SubProblem &>(_fe_problem);
1170 
1171  const Elem * primary_elem = info._elem;
1172  unsigned int primary_side = info._side_num;
1173  std::vector<Point> points;
1174  points.push_back(info._closest_point);
1175 
1176  // *These next steps MUST be done in this order!*
1177  // ADL: This is a Chesterton's fence situation. I don't know which calls exactly the above comment
1178  // is referring to. If I had to guess I would guess just the reinitNodeFace and prepareAssembly
1179  // calls since the former will size the variable's dof indices and then the latter will resize the
1180  // residual/Jacobian based off the variable's cached dof indices size
1181 
1182  // This reinits the variables that exist on the secondary node
1183  _fe_problem.reinitNodeFace(&secondary_node, secondary_boundary, 0);
1184 
1185  // This will set aside residual and jacobian space for the variables that have dofs on
1186  // the secondary node
1188 
1189  _fe_problem.setNeighborSubdomainID(primary_elem, 0);
1190 
1191  //
1192  // Reinit material on undisplaced mesh
1193  //
1194 
1195  const Elem * const undisplaced_primary_elem =
1196  displaced ? _mesh.elemPtr(primary_elem->id()) : primary_elem;
1197  const Point undisplaced_primary_physical_point =
1198  [&points, displaced, primary_elem, undisplaced_primary_elem]()
1199  {
1200  if (displaced)
1201  {
1202  const Point reference_point =
1203  FEMap::inverse_map(primary_elem->dim(), primary_elem, points[0]);
1204  return FEMap::map(primary_elem->dim(), undisplaced_primary_elem, reference_point);
1205  }
1206  else
1207  // If our penetration locator is on the reference mesh, then our undisplaced
1208  // physical point is simply the point coming from the penetration locator
1209  return points[0];
1210  }();
1211 
1213  undisplaced_primary_elem, primary_side, {undisplaced_primary_physical_point}, 0);
1214  // Stateful material properties are only initialized for neighbor material data for internal faces
1215  // for discontinuous Galerkin methods or for conforming interfaces for interface kernels. We don't
1216  // have either of those use cases here where we likely have disconnected meshes
1217  _fe_problem.reinitMaterialsNeighbor(primary_elem->subdomain_id(), 0, /*swap_stateful=*/false);
1218 
1219  // Reinit points for constraint enforcement
1220  if (displaced)
1221  subproblem.reinitNeighborPhys(primary_elem, primary_side, points, 0);
1222 }
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:3240
MPI_Info info
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid) override
dof_id_type id() const
void reinitMaterialsNeighbor(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on the neighboring element face
SubProblem & subproblem()
Definition: SystemBase.h:102
virtual void prepareAssembly(const THREAD_ID tid) override
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseMesh & _mesh
Definition: SystemBase.h:991
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 423 of file SystemBase.C.

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

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

435 {
436  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
437  for (const auto & var : vars)
438  {
439  var->reinitNodesNeighbor(nodes);
440  var->computeNodalNeighborValues();
441  }
442 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

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

446 {
447  const std::vector<MooseVariableScalar *> & vars = _vars[tid].scalars();
448  for (const auto & var : vars)
449  var->reinit(reinit_for_derivative_reordering);
450 }
char ** vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

◆ removeMatrix()

void SystemBase::removeMatrix ( TagID  tag)
inherited

Removes a matrix with a given tag.

Parameters
tag_nameThe name of the tag

Definition at line 591 of file SystemBase.C.

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

◆ removeVector() [1/2]

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

Remove a vector from the system with the given name.

Definition at line 1336 of file SystemBase.C.

Referenced by SystemBase::restoreOldSolutions().

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

◆ removeVector() [2/2]

void SystemBase::removeVector ( TagID  tag_id)
inherited

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

Parameters
tag_idTag ID

Definition at line 701 of file SystemBase.C.

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

◆ residualAndJacobianTogether()

void NonlinearSystem::residualAndJacobianTogether ( )
overridevirtualinherited

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

Implements NonlinearSystemBase.

Definition at line 393 of file NonlinearSystem.C.

394 {
396  mooseError(
397  "Evaluting the residual and Jacobian together does not make sense for a JFNK solve type in "
398  "which only function evaluations are required, e.g. there is no need to form a matrix");
399 
400  nonlinearSolver()->residual_object = nullptr;
401  nonlinearSolver()->jacobian = nullptr;
402  nonlinearSolver()->residual_and_jacobian_object = &_resid_and_jac_functor;
403 }
virtual libMesh::NonlinearSolver< Number > * nonlinearSolver() override
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
ComputeResidualAndJacobian _resid_and_jac_functor
Jacobian-Free Newton Krylov.
Definition: MooseTypes.h:894
Moose::SolveType _type
Definition: SolverParams.h:19
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.

◆ residualCopy()

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

Reimplemented from SystemBase.

Definition at line 3550 of file NonlinearSystemBase.C.

3551 {
3552  if (!_residual_copy.get())
3554 
3555  return *_residual_copy;
3556 }
const Parallel::Communicator & _communicator
std::unique_ptr< NumericVector< Number > > _residual_copy
Copy of the residual vector, or nullptr if a copy is not needed.

◆ residualGhosted()

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

Reimplemented from SystemBase.

Definition at line 3559 of file NonlinearSystemBase.C.

3560 {
3561  _need_residual_ghosted = true;
3562  if (!_residual_ghosted)
3563  {
3564  // The first time we realize we need a ghosted residual vector,
3565  // we add it.
3566  _residual_ghosted = &addVector("residual_ghosted", false, GHOSTED);
3567 
3568  // If we've already realized we need time and/or non-time
3569  // residual vectors, but we haven't yet realized they need to be
3570  // ghosted, fix that now.
3571  //
3572  // If an application changes its mind, the libMesh API lets us
3573  // change the vector.
3574  if (_Re_time)
3575  {
3576  const auto vector_name = _subproblem.vectorTagName(_Re_time_tag);
3577  _Re_time = &system().add_vector(vector_name, false, GHOSTED);
3578  }
3579  if (_Re_non_time)
3580  {
3581  const auto vector_name = _subproblem.vectorTagName(_Re_non_time_tag);
3582  _Re_non_time = &system().add_vector(vector_name, false, GHOSTED);
3583  }
3584  }
3585  return *_residual_ghosted;
3586 }
NumericVector< Number > * _Re_time
residual vector for time contributions
TagID _Re_time_tag
Tag for time contribution residual.
NumericVector< Number > * _Re_non_time
residual vector for non-time contributions
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
bool _need_residual_ghosted
Whether or not a ghosted copy of the residual needs to be made.
TagID _Re_non_time_tag
Tag for non-time contribution residual.
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
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:222
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ residualSetup()

void NonlinearSystemBase::residualSetup ( )
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 1732 of file NonlinearSystemBase.C.

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

1733 {
1734  TIME_SECTION("residualSetup", 3);
1735 
1737 
1738  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1739  {
1740  _kernels.residualSetup(tid);
1743  if (_doing_dg)
1749  }
1756 
1757 #ifdef MOOSE_KOKKOS_ENABLED
1762 #endif
1763 
1764  // Avoid recursion
1765  if (this == &_fe_problem.currentNonlinearSystem())
1767 }
virtual void residualSetup(THREAD_ID tid=0) const
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_kernels
unsigned int n_threads()
MooseObjectTagWarehouse< ResidualObject > _kokkos_kernels
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)
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
NonlinearSystemBase & currentNonlinearSystem()
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
MooseObjectTagWarehouse< ResidualObject > _kokkos_integrated_bcs
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
MooseObjectWarehouse< ElementDamper > _element_dampers
Element Dampers for each thread.
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
virtual void residualSetup()
Definition: SystemBase.C:1588
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:237
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ residualVector()

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

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

Definition at line 1090 of file NonlinearSystemBase.C.

1091 {
1092  mooseDeprecated("Please use getVector()");
1093  switch (tag)
1094  {
1095  case 0:
1096  return getResidualNonTimeVector();
1097 
1098  case 1:
1099  return getResidualTimeVector();
1100 
1101  default:
1102  mooseError("The required residual vector is not available");
1103  }
1104 }
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:311
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:363
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 543 of file SystemBase.C.

544 {
545  const auto states =
546  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
547  if (states > 1)
548  for (unsigned int i = 1; i <= states - 1; ++i)
549  if (_saved_solution_states[i])
550  {
552  removeVector("save_solution_state_" + std::to_string(i));
553  _saved_solution_states[i] = nullptr;
554  }
555 
557  {
559  removeVector("save_solution_dot_old");
560  _saved_dot_old = nullptr;
561  }
563  {
565  removeVector("save_solution_dotdot_old");
566  _saved_dotdot_old = nullptr;
567  }
568 }
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:1433
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:265
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:264
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:1034
void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Definition: SystemBase.C:1336
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:1035
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1081

◆ restoreSolutions()

void SolverSystem::restoreSolutions ( )
finaloverridevirtualinherited

Restore current solutions (call after your solve failed)

Reimplemented from SystemBase.

Definition at line 43 of file SolverSystem.C.

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

◆ RHS()

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

Implements NonlinearSystemBase.

Definition at line 58 of file NonlinearSystem.h.

Referenced by NonlinearSystem::computeScalingResidual().

58 { return *_nl_implicit_sys.rhs; }
libMesh::NonlinearImplicitSystem & _nl_implicit_sys
NumericVector< Number > * rhs

◆ saveOldSolutionForFixedPointRelaxation()

void SolverSystem::saveOldSolutionForFixedPointRelaxation ( )
inherited

Definition at line 91 of file SolverSystem.C.

92 {
93  if (MooseUtils::absoluteFuzzyEqual(_fixed_point_relaxation_factor, 1.0))
94  return;
95 
98 
99  // Just in case checking if someone already allocated one which does not match
101  solution().type(),
102  "Fixed point relaxation requires the previous fixed point solution state to have "
103  "the same parallel type as the system solution.");
104 
106 }
NumericVector< Number > & solution()
Definition: SystemBase.h:197
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:1433
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:1087
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time, libMesh::ParallelType parallel_type=GHOSTED)
Registers that the solution state state is needed.
Definition: SystemBase.C:1452
Real _fixed_point_relaxation_factor
Used for relaxing entire system solution during fixed point (multi-)system iterations.
Definition: SolverSystem.h:131
libMesh::ParallelType solutionStateParallelType(const unsigned int state, const Moose::SolutionIterationType iteration_type) const
Returns the parallel type of the given solution state.
Definition: SystemBase.C:1442

◆ saveOldSolutions()

void SystemBase::saveOldSolutions ( )
virtualinherited

Save the old and older solutions.

Definition at line 511 of file SystemBase.C.

512 {
513  const auto states =
514  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
515  if (states > 1)
516  {
517  _saved_solution_states.resize(states);
518  for (unsigned int i = 1; i <= states - 1; ++i)
519  if (!_saved_solution_states[i])
521  &addVector("save_solution_state_" + std::to_string(i), false, PARALLEL);
522 
523  for (unsigned int i = 1; i <= states - 1; ++i)
525  }
526 
528  _saved_dot_old = &addVector("save_solution_dot_old", false, PARALLEL);
530  _saved_dotdot_old = &addVector("save_solution_dotdot_old", false, PARALLEL);
531 
532  if (solutionUDotOld())
534 
535  if (solutionUDotDotOld())
537 }
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:1433
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:265
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:264
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:1034
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:1035
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1081

◆ scaleSystemSolution()

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

Scale the solution vector.

Parameters
tagSystem tag.
factorThe scaling factor.

Definition at line 81 of file MooseEigenSystem.C.

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

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

◆ scalingGroupVariables()

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

Definition at line 735 of file NonlinearSystemBase.h.

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

◆ serializedSolution()

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

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

Reimplemented in DisplacedSystem.

Definition at line 1635 of file SystemBase.C.

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

1636 {
1637  if (!_serialized_solution.get())
1638  {
1640  _serialized_solution->init(system().n_dofs(), false, SERIAL);
1641  }
1642 
1643  return *_serialized_solution;
1644 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const Parallel::Communicator & _communicator
std::unique_ptr< NumericVector< Number > > _serialized_solution
Serialized version of the solution vector, or nullptr if a serialized solution is not needed...
Definition: SystemBase.h:1068

◆ serializeSolution()

void SolverSystem::serializeSolution ( )
inherited

Definition at line 52 of file SolverSystem.C.

Referenced by SolverSystem::setSolution().

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

◆ setActiveScalarVariableCoupleableVectorTags()

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

Set the active vector tags for the scalar variables.

Definition at line 1615 of file SystemBase.C.

Referenced by SubProblem::setActiveScalarVariableCoupleableVectorTags().

1617 {
1618  _vars[tid].setActiveScalarVariableCoupleableVectorTags(vtags);
1619 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

◆ setActiveVariableCoupleableVectorTags()

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

Set the active vector tags for the variables.

Definition at line 1609 of file SystemBase.C.

Referenced by SubProblem::setActiveFEVariableCoupleableVectorTags().

1610 {
1611  _vars[tid].setActiveVariableCoupleableVectorTags(vtags);
1612 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

◆ setConstraintSecondaryValues()

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

Sets the value of constrained variables in the solution vector.

Definition at line 1225 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::setInitialSolution().

1226 {
1227 
1228  if (displaced)
1229  mooseAssert(_fe_problem.getDisplacedProblem(),
1230  "If we're calling this method with displaced = true, then we better well have a "
1231  "displaced problem");
1232  auto & subproblem = displaced ? static_cast<SubProblem &>(*_fe_problem.getDisplacedProblem())
1233  : static_cast<SubProblem &>(_fe_problem);
1234  const auto & penetration_locators = subproblem.geomSearchData()._penetration_locators;
1235 
1236  bool constraints_applied = false;
1237 
1238  for (const auto & it : penetration_locators)
1239  {
1240  PenetrationLocator & pen_loc = *(it.second);
1241 
1242  std::vector<dof_id_type> & secondary_nodes = pen_loc._nearest_node._secondary_nodes;
1243 
1244  BoundaryID secondary_boundary = pen_loc._secondary_boundary;
1245  BoundaryID primary_boundary = pen_loc._primary_boundary;
1246 
1247  if (_constraints.hasActiveNodeFaceConstraints(secondary_boundary, displaced))
1248  {
1249  const auto & constraints =
1250  _constraints.getActiveNodeFaceConstraints(secondary_boundary, displaced);
1251  std::unordered_set<unsigned int> needed_mat_props;
1252  for (const auto & constraint : constraints)
1253  {
1254  const auto & mp_deps = constraint->getMatPropDependencies();
1255  needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
1256  }
1257  _fe_problem.setActiveMaterialProperties(needed_mat_props, /*tid=*/0);
1258 
1259  for (unsigned int i = 0; i < secondary_nodes.size(); i++)
1260  {
1261  dof_id_type secondary_node_num = secondary_nodes[i];
1262  Node & secondary_node = _mesh.nodeRef(secondary_node_num);
1263 
1264  if (secondary_node.processor_id() == processor_id())
1265  {
1266  if (pen_loc._penetration_info[secondary_node_num])
1267  {
1268  PenetrationInfo & info = *pen_loc._penetration_info[secondary_node_num];
1269 
1270  reinitNodeFace(secondary_node, secondary_boundary, info, displaced);
1271 
1272  for (const auto & nfc : constraints)
1273  {
1274  if (nfc->isExplicitConstraint())
1275  continue;
1276  // Return if this constraint does not correspond to the primary-secondary pair
1277  // prepared by the outer loops.
1278  // This continue statement is required when, e.g. one secondary surface constrains
1279  // more than one primary surface.
1280  if (nfc->secondaryBoundary() != secondary_boundary ||
1281  nfc->primaryBoundary() != primary_boundary)
1282  continue;
1283 
1284  if (nfc->shouldApply())
1285  {
1286  constraints_applied = true;
1287  nfc->computeSecondaryValue(solution);
1288  }
1289 
1290  if (nfc->hasWritableCoupledVariables())
1291  {
1292  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
1293  for (auto * var : nfc->getWritableCoupledVariables())
1294  {
1295  if (var->isNodalDefined())
1296  var->insert(_fe_problem.getAuxiliarySystem().solution());
1297  }
1298  }
1299  }
1300  }
1301  }
1302  }
1303  }
1304  }
1305 
1306  // go over NodeELemConstraints
1307  std::set<dof_id_type> unique_secondary_node_ids;
1308 
1309  for (const auto & secondary_id : _mesh.meshSubdomains())
1310  {
1311  for (const auto & primary_id : _mesh.meshSubdomains())
1312  {
1313  if (_constraints.hasActiveNodeElemConstraints(secondary_id, primary_id, displaced))
1314  {
1315  const auto & constraints =
1316  _constraints.getActiveNodeElemConstraints(secondary_id, primary_id, displaced);
1317 
1318  // get unique set of ids of all nodes on current block
1319  unique_secondary_node_ids.clear();
1320  const MeshBase & meshhelper = _mesh.getMesh();
1321  for (const auto & elem : as_range(meshhelper.active_subdomain_elements_begin(secondary_id),
1322  meshhelper.active_subdomain_elements_end(secondary_id)))
1323  {
1324  for (auto & n : elem->node_ref_range())
1325  unique_secondary_node_ids.insert(n.id());
1326  }
1327 
1328  for (auto secondary_node_id : unique_secondary_node_ids)
1329  {
1330  Node & secondary_node = _mesh.nodeRef(secondary_node_id);
1331 
1332  // check if secondary node is on current processor
1333  if (secondary_node.processor_id() == processor_id())
1334  {
1335  // This reinits the variables that exist on the secondary node
1336  _fe_problem.reinitNodeFace(&secondary_node, secondary_id, 0);
1337 
1338  // This will set aside residual and jacobian space for the variables that have dofs
1339  // on the secondary node
1341 
1342  for (const auto & nec : constraints)
1343  {
1344  if (nec->shouldApply())
1345  {
1346  constraints_applied = true;
1347  nec->computeSecondaryValue(solution);
1348  }
1349  }
1350  }
1351  }
1352  }
1353  }
1354  }
1355 
1356  // See if constraints were applied anywhere
1357  _communicator.max(constraints_applied);
1358 
1359  if (constraints_applied)
1360  {
1361  solution.close();
1362  update();
1363  }
1364 }
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:197
Data structure used to hold penetration information.
const std::vector< std::shared_ptr< NodeFaceConstraint > > & getActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
const Parallel::Communicator & _communicator
std::map< dof_id_type, PenetrationInfo * > & _penetration_info
Data structure of nodes and their associated penetration information.
bool hasActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
const std::vector< std::shared_ptr< NodeElemConstraintBase > > & getActiveNodeElemConstraints(SubdomainID secondary_id, SubdomainID primary_id, bool displaced) const
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:834
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1244
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
std::vector< dof_id_type > _secondary_nodes
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3575
boundary_id_type BoundaryID
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
SubProblem & subproblem()
Definition: SystemBase.h:102
virtual GeometricSearchData & geomSearchData()=0
AuxiliarySystem & getAuxiliarySystem()
virtual void prepareAssembly(const THREAD_ID tid) override
virtual void close()=0
ConstraintWarehouse _constraints
Constraints storage object.
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
MooseMesh & _mesh
Definition: SystemBase.h:991
void max(const T &r, T &o, Request &req) const
void reinitNodeFace(const Node &secondary_node, const BoundaryID secondary_boundary, const PenetrationInfo &info, const bool displaced)
Reinitialize quantities such as variables, residuals, Jacobians, materials for node-face constraints...
processor_id_type processor_id() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const
BoundaryID _primary_boundary
uint8_t dof_id_type
NearestNodeLocator & _nearest_node
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition: MooseMesh.C:3298

◆ setFixedPointRelaxationFactor()

void SolverSystem::setFixedPointRelaxationFactor ( const Real  relaxation_factor)
inherited

Enable solution under/over-relaxation for fixed point iterations.

Intended for segregated multi-system fixed point iterations where the system is solved repeatedly with coefficients that depend on other systems/loops (e.g. deferred correction). A value of 1 disables relaxation.

The relaxed update is: u <- relaxation_factor * u_new + (1 - relaxation_factor) * u_old

Definition at line 79 of file SolverSystem.C.

80 {
81  _fixed_point_relaxation_factor = relaxation_factor;
82 }
Real _fixed_point_relaxation_factor
Used for relaxing entire system solution during fixed point (multi-)system iterations.
Definition: SolverSystem.h:131

◆ setInitialResidual()

void NonlinearSystemBase::setInitialResidual ( Real  r)
inherited

Record the initial residual (for later relative convergence check)

Definition at line 792 of file NonlinearSystemBase.C.

Referenced by DefaultNonlinearConvergence::checkConvergence().

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

◆ setInitialSolution()

void NonlinearSystemBase::setInitialSolution ( )
inherited

Definition at line 958 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::preSolve().

959 {
961 
962  NumericVector<Number> & initial_solution(solution());
963  if (_predictor.get())
964  {
965  if (_predictor->shouldApply())
966  {
967  TIME_SECTION("applyPredictor", 2, "Applying Predictor");
968 
969  _predictor->apply(initial_solution);
970  _fe_problem.predictorCleanup(initial_solution);
971  }
972  else
973  _console << " Skipping predictor this step" << std::endl;
974  }
975 
976  // do nodal BC
977  {
978  TIME_SECTION("initialBCs", 2, "Applying BCs To Initial Condition");
979 
981  for (const auto & bnode : bnd_nodes)
982  {
983  BoundaryID boundary_id = bnode->_bnd_id;
984  Node * node = bnode->_node;
985 
986  if (node->processor_id() == processor_id())
987  {
988  bool has_preset_nodal_bcs = _preset_nodal_bcs.hasActiveBoundaryObjects(boundary_id);
989  bool has_ad_preset_nodal_bcs = _ad_preset_nodal_bcs.hasActiveBoundaryObjects(boundary_id);
990 
991  // reinit variables in nodes
992  if (has_preset_nodal_bcs || has_ad_preset_nodal_bcs)
993  _fe_problem.reinitNodeFace(node, boundary_id, 0);
994 
995  if (has_preset_nodal_bcs)
996  {
997  const auto & preset_bcs = _preset_nodal_bcs.getActiveBoundaryObjects(boundary_id);
998  for (const auto & preset_bc : preset_bcs)
999  preset_bc->computeValue(initial_solution);
1000  }
1001  if (has_ad_preset_nodal_bcs)
1002  {
1003  const auto & preset_bcs_res = _ad_preset_nodal_bcs.getActiveBoundaryObjects(boundary_id);
1004  for (const auto & preset_bc : preset_bcs_res)
1005  preset_bc->computeValue(initial_solution);
1006  }
1007  }
1008  }
1009  }
1010 
1011 #ifdef MOOSE_KOKKOS_ENABLED
1014 #endif
1015 
1016  _sys.solution->close();
1017  update();
1018 
1019  // Set constraint secondary values
1020  setConstraintSecondaryValues(initial_solution, false);
1021 
1023  setConstraintSecondaryValues(initial_solution, true);
1024 }
virtual void predictorCleanup(NumericVector< libMesh::Number > &ghosted_solution)
Perform cleanup tasks after application of predictor to solution vector.
NumericVector< Number > & solution()
Definition: SystemBase.h:197
bool hasObjects(THREAD_ID tid=0) const
Convenience functions for determining if objects exist.
MooseObjectWarehouse< ResidualObject > _kokkos_preset_nodal_bcs
void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1244
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const ConstBndNodeRange & getCurrentAlgebraicBndNodeRange()
virtual void deactivateAllMatrixTags()
Make matrices inactive.
Definition: SystemBase.C:1120
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
boundary_id_type BoundaryID
std::unique_ptr< NumericVector< Number > > solution
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
libMesh::System & _sys
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
processor_id_type processor_id() const
std::shared_ptr< Predictor > _predictor
If predictor is active, this is non-NULL.
void setKokkosInitialSolution()
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
processor_id_type processor_id() const
void setConstraintSecondaryValues(NumericVector< Number > &solution, bool displaced)
Sets the value of constrained variables in the solution vector.
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ setKokkosInitialSolution()

void NonlinearSystemBase::setKokkosInitialSolution ( )
inherited

◆ setMooseKSPNormType()

void SolverSystem::setMooseKSPNormType ( MooseEnum  kspnorm)
inherited

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

Parameters
kspnormThe required norm

Definition at line 148 of file SolverSystem.C.

Referenced by MoosePreconditioner::MoosePreconditioner().

149 {
150  if (kspnorm == "none")
152  else if (kspnorm == "preconditioned")
154  else if (kspnorm == "unpreconditioned")
156  else if (kspnorm == "natural")
158  else if (kspnorm == "default")
160  else
161  mooseError("Unknown ksp norm type specified.");
162 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
Use whatever we have in PETSc.
Definition: MooseTypes.h:885
Moose::MooseKSPNormType _ksp_norm
KSP norm type.
Definition: SolverSystem.h:125

◆ setPCSide()

void SolverSystem::setPCSide ( MooseEnum  pcs)
inherited

Set the side on which the preconditioner is applied to.

Parameters
pcsThe required preconditioning side

Definition at line 133 of file SolverSystem.C.

Referenced by MoosePreconditioner::MoosePreconditioner().

134 {
135  if (pcs == "left")
137  else if (pcs == "right")
139  else if (pcs == "symmetric")
141  else if (pcs == "default")
143  else
144  mooseError("Unknown PC side specified.");
145 }
Moose::PCSideType _pc_side
Preconditioning side.
Definition: SolverSystem.h:123
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
Use whatever we have in PETSc.
Definition: MooseTypes.h:873

◆ setPreconditioner()

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

Sets a preconditioner.

Parameters
pcThe preconditioner to be set

Definition at line 3674 of file NonlinearSystemBase.C.

Referenced by SetupPreconditionerAction::act().

3675 {
3676  if (_preconditioner.get() != nullptr)
3677  mooseError("More than one active Preconditioner detected");
3678 
3679  _preconditioner = pc;
3680 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.

◆ setPredictor()

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

Definition at line 1027 of file NonlinearSystemBase.C.

Referenced by SetupPredictorAction::act().

1028 {
1029  _predictor = predictor;
1030 }
std::shared_ptr< Predictor > _predictor
If predictor is active, this is non-NULL.

◆ setPreSMOResidual()

void NonlinearSystemBase::setPreSMOResidual ( bool  use)
inlineinherited

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

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

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

Definition at line 286 of file NonlinearSystemBase.h.

Referenced by FEProblemSolve::FEProblemSolve().

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

◆ setPreviousNewtonSolution()

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

Definition at line 3953 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::computePostCheck().

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

◆ setSolution()

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

Set the solution to a given vector.

Parameters
solnThe vector which should be treated as the solution.

Definition at line 67 of file SolverSystem.C.

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

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

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

3651 {
3652  *_u_dot = u_dot;
3653 }
NumericVector< Number > * _u_dot
solution vector for u^dot
Definition: SystemBase.h:1006

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

3657 {
3658  *_u_dotdot = u_dotdot;
3659 }
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot
Definition: SystemBase.h:1008

◆ setSolutionUDotDotOld()

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

Definition at line 3668 of file NonlinearSystemBase.C.

3669 {
3670  *_u_dotdot_old = u_dotdot_old;
3671 }
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
Definition: SystemBase.h:1013

◆ setSolutionUDotOld()

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

Definition at line 3662 of file NonlinearSystemBase.C.

3663 {
3664  *_u_dot_old = u_dot_old;
3665 }
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
Definition: SystemBase.h:1011

◆ setupDampers()

void NonlinearSystemBase::setupDampers ( )
inherited

Setup damping stuff (called before we actually start)

Definition at line 3689 of file NonlinearSystemBase.C.

Referenced by NonlinearSystemBase::preInit().

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

◆ setupDM()

void NonlinearSystemBase::setupDM ( )
inherited

Setup the PETSc DM object (when appropriate)

Definition at line 463 of file NonlinearSystemBase.C.

Referenced by FEProblemBase::solve().

464 {
465  if (_fsp)
466  _fsp->setupDM();
467 }
virtual void setupDM()=0
setup the data management data structure that manages the field split
FieldSplitPreconditionerBase * _fsp
The field split preconditioner if this sytem is using one.

◆ setupFiniteDifferencedPreconditioner()

void NonlinearSystem::setupFiniteDifferencedPreconditioner ( )
overridevirtualinherited

Implements NonlinearSystemBase.

Definition at line 234 of file NonlinearSystem.C.

Referenced by NonlinearSystem::potentiallySetupFiniteDifferencing().

235 {
236  std::shared_ptr<FiniteDifferencePreconditioner> fdp =
238  if (!fdp)
239  mooseError("Did not setup finite difference preconditioner, and please add a preconditioning "
240  "block with type = fdp");
241 
242  if (fdp->finiteDifferenceType() == "coloring")
243  {
246  }
247 
248  else if (fdp->finiteDifferenceType() == "standard")
249  {
252  }
253  else
254  mooseError("Unknown finite difference type");
255 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
std::shared_ptr< MoosePreconditioner > _preconditioner
Preconditioner.
void setupColoringFiniteDifferencedPreconditioner()
According to the nonzero pattern provided in the matrix, a graph is constructed.
bool _use_coloring_finite_difference
Finite difference preconditioner.
void setupStandardFiniteDifferencedPreconditioner()
Form preconditioning matrix via a standard finite difference method column-by-column.

◆ setVariableGlobalDoFs()

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

set all the global dof indices for a variable

Parameters
var_nameThe name of the variable

Definition at line 187 of file SystemBase.C.

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

◆ setVerboseFlag()

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

Sets the verbose flag.

Parameters
[in]verboseVerbose flag

Definition at line 135 of file SystemBase.h.

Referenced by Executioner::Executioner().

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

◆ shouldEvaluatePreSMOResidual()

bool NonlinearSystemBase::shouldEvaluatePreSMOResidual ( ) const
inherited

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

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

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

Definition at line 753 of file NonlinearSystemBase.C.

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

754 {
756  return false;
757 
758  // The legacy behavior (#10464) _always_ performs the pre-SMO residual evaluation
759  // regardless of whether it is needed.
760  //
761  // This is not ideal and has been fixed by #23472. This legacy option ensures a smooth transition
762  // to the new behavior. Modules and Apps that want to migrate to the new behavior should set this
763  // parameter to false.
764  if (_app.parameters().get<bool>("use_legacy_initial_residual_evaluation_behavior"))
765  return true;
766 
767  return _use_pre_smo_residual;
768 }
bool _use_pre_smo_residual
Whether to use the pre-SMO initial residual in the relative convergence check.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
Solving a linear problem.
Definition: MooseTypes.h:897
Moose::SolveType _type
Definition: SolverParams.h:19
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
MooseApp & _app
Definition: SystemBase.h:988
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.

◆ sizeVariableMatrixData()

void SystemBase::sizeVariableMatrixData ( )
inherited

size the matrix data for each variable for the number of matrix tags we have

Definition at line 1708 of file SystemBase.C.

1709 {
1710  for (const auto & warehouse : _vars)
1711  for (const auto & [var_num, var_ptr] : warehouse.numberToVariableMap())
1712  var_ptr->sizeMatrixTagData();
1713 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

◆ skipNextSolutionToOldCopy()

void SystemBase::skipNextSolutionToOldCopy ( )
inlineinherited

Skip the next copy from the solution vector to the old solution vector old -> older is still performed.

Definition at line 973 of file SystemBase.h.

bool _skip_next_solution_to_old_copy
Whether to skip the next copy from the solution to the old vector.
Definition: SystemBase.h:1083

◆ solution() [1/2]

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

Definition at line 197 of file SystemBase.h.

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

197 { 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:1433

◆ solution() [2/2]

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

Definition at line 200 of file SystemBase.h.

200 { 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:1433

◆ solutionInternal()

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

Internal getter for solution owned by libMesh.

Implements SystemBase.

Definition at line 141 of file SolverSystem.h.

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

◆ solutionOld() [1/2]

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

◆ solutionOld() [2/2]

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

Definition at line 201 of file SystemBase.h.

201 { 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:1433

◆ solutionOlder() [1/2]

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

Definition at line 199 of file SystemBase.h.

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

199 { 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:1433

◆ solutionOlder() [2/2]

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

Definition at line 202 of file SystemBase.h.

202 { 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:1433

◆ solutionPreviousNewton() [1/2]

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

Reimplemented in DisplacedSystem.

Definition at line 1357 of file SystemBase.C.

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

1358 {
1361  else
1362  return nullptr;
1363 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:925
const TagName PREVIOUS_NL_SOLUTION_TAG
Definition: MooseTypes.C:28
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:934

◆ solutionPreviousNewton() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 1348 of file SystemBase.C.

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

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

Referenced by SolverSystem::applyFixedPointRelaxation(), SystemBase::copyOldSolutions(), SystemBase::copyPreviousFixedPointSolutions(), SystemBase::copyPreviousNonlinearSolutions(), PointwiseRenormalizeVector::execute(), PointwiseRenormalizeVector::finalize(), MooseVariableBase::getSolution(), SystemBase::restoreOldSolutions(), SolverSystem::saveOldSolutionForFixedPointRelaxation(), SystemBase::saveOldSolutions(), SystemBase::solution(), SystemBase::solutionOld(), SystemBase::solutionOlder(), and DisplacedSystem::solutionState().

1435 {
1436  if (!hasSolutionState(state, iteration_type))
1437  needSolutionState(state, iteration_type);
1438  return *_solution_states[static_cast<unsigned short>(iteration_type)][state];
1439 }
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:1087
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time, libMesh::ParallelType parallel_type=GHOSTED)
Registers that the solution state state is needed.
Definition: SystemBase.C:1452
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079

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

1406 {
1407  if (!hasSolutionState(state, iteration_type))
1408  mooseError("For iteration type '",
1409  Moose::stringify(iteration_type),
1410  "': solution state ",
1411  state,
1412  " was requested in ",
1413  name(),
1414  " but only up to state ",
1415  (_solution_states[static_cast<unsigned short>(iteration_type)].size() == 0)
1416  ? 0
1417  : _solution_states[static_cast<unsigned short>(iteration_type)].size() - 1,
1418  " is available.");
1419 
1420  const auto & solution_states = _solution_states[static_cast<unsigned short>(iteration_type)];
1421 
1422  if (state == 0)
1423  mooseAssert(solution_states[0] == &solutionInternal(), "Inconsistent current solution");
1424  else
1425  mooseAssert(solution_states[state] ==
1426  &getVector(oldSolutionStateVectorName(state, iteration_type)),
1427  "Inconsistent solution state");
1428 
1429  return *solution_states[state];
1430 }
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:311
virtual const std::string & name() const
Definition: SystemBase.C:1342
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:1087
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
TagName oldSolutionStateVectorName(const unsigned int, Moose::SolutionIterationType iteration_type) const
Gets the vector name used for an old (not current) solution state.
Definition: SystemBase.C:1383
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:934

◆ solutionStateParallelType()

libMesh::ParallelType SystemBase::solutionStateParallelType ( const unsigned int  state,
const Moose::SolutionIterationType  iteration_type 
) const
inherited

Returns the parallel type of the given solution state.

Definition at line 1442 of file SystemBase.C.

Referenced by SolverSystem::applyFixedPointRelaxation(), SystemBase::needSolutionState(), and SolverSystem::saveOldSolutionForFixedPointRelaxation().

1444 {
1445  if (!hasSolutionState(state, iteration_type))
1446  mooseError("solutionStateParallelType() may only be called if the solution state exists.");
1447 
1448  return _solution_states[static_cast<unsigned short>(iteration_type)][state]->type();
1449 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
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:1087
std::array< std::vector< NumericVector< Number > * >, 3 > _solution_states
2D array of solution state vector pointers; first index corresponds to SolutionIterationType, second index corresponds to state index (0=current, 1=old, 2=older)
Definition: SystemBase.h:1079

◆ 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 899 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:1061

◆ solutionUDot() [1/2]

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

◆ solutionUDot() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 266 of file SystemBase.h.

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

◆ solutionUDotDot() [1/2]

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

◆ solutionUDotDot() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 267 of file SystemBase.h.

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

◆ solutionUDotDotOld() [1/2]

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

◆ solutionUDotDotOld() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 269 of file SystemBase.h.

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

◆ solutionUDotOld() [1/2]

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

◆ solutionUDotOld() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 268 of file SystemBase.h.

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

◆ solve()

void NonlinearSystem::solve ( )
overridevirtualinherited

Solve the system (using libMesh magic)

Implements NonlinearSystemBase.

Definition at line 141 of file NonlinearSystem.C.

142 {
143  // Only attach the postcheck function to the solver if we actually
144  // have dampers or if the FEProblemBase needs to update the solution,
145  // which is also done during the linesearch postcheck. It doesn't
146  // hurt to do this multiple times, it is just setting a pointer.
150 
152  {
153  TIME_SECTION("nlPreSMOResidual", 3, "Computing Pre-SMO Residual");
154  // Calculate the pre-SMO residual for use in the convergence criterion.
160  _console << " * Nonlinear |R| = "
162  << " (Before preset BCs, predictors, correctors, and constraints)\n";
163  _console << std::flush;
164  }
165 
166  const bool presolve_succeeded = preSolve();
167  if (!presolve_succeeded)
168  return;
169 
171 
172  const bool time_integrator_solve = std::any_of(_time_integrators.begin(),
173  _time_integrators.end(),
174  [](auto & ti) { return ti->overridesSolve(); });
175  if (time_integrator_solve)
176  mooseAssert(_time_integrators.size() == 1,
177  "If solve is overridden, then there must be only one time integrator");
178 
179  if (time_integrator_solve)
180  _time_integrators.front()->solve();
181  else
182  system().solve();
183 
184  for (auto & ti : _time_integrators)
185  {
186  if (!ti->overridesSolve())
187  ti->setNumIterationsLastSolve();
188  ti->postSolve();
189  }
190 
191  if (!_time_integrators.empty())
192  {
193  _n_iters = _time_integrators.front()->getNumNonlinearIterations();
194  _n_linear_iters = _time_integrators.front()->getNumLinearIterations();
195  }
196  else
197  {
199  _n_linear_iters = _nl_implicit_sys.nonlinear_solver->get_total_linear_iterations();
200  }
201 
202  // store info about the solve
204 
205  // determine whether solution invalid occurs in the converged solution
207 
209  LibmeshPetscCall(MatFDColoringDestroy(&_fdcoloring));
210 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
libMesh::NonlinearImplicitSystem & _nl_implicit_sys
void checkInvalidSolution()
Definition: SolverSystem.C:165
NumericVector< Number > * rhs
unsigned int n_nonlinear_iterations() const
Real _pre_smo_residual
The pre-SMO residual, see setPreSMOResidual for a detailed explanation.
bool hasDampers()
Whether or not this system has dampers.
auto max(const L &left, const R &right)
void compute_postcheck(const NumericVector< Number > &old_soln, NumericVector< Number > &search_direction, NumericVector< Number > &new_soln, bool &changed_search_direction, bool &changed_new_soln, NonlinearImplicitSystem &sys)
virtual void computeResidualSys(libMesh::NonlinearImplicitSystem &sys, const NumericVector< libMesh::Number > &soln, NumericVector< libMesh::Number > &residual)
This function is called by Libmesh to form a residual.
virtual Real l2_norm() const=0
virtual bool shouldUpdateSolution()
Check to see whether the problem should update the solution.
void needsPreviousNewtonIteration(bool state)
Set a flag that indicated that user required values for the previous Newton iterate.
bool shouldEvaluatePreSMOResidual() const
We offer the option to check convergence against the pre-SMO residual.
bool _use_coloring_finite_difference
virtual void solve()
virtual void close()=0
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:120
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual void potentiallySetupFiniteDifferencing() override
Create finite differencing contexts for assembly of the Jacobian and/or approximating the action of t...
static std::string outputNorm(const Real &old_norm, const Real &norm, const unsigned int precision=6)
A helper function for outputting norms in color.
Definition: Console.C:619
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
bool preSolve()
Perform some steps to get ready for the solver.
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ stopSolve()

void NonlinearSystem::stopSolve ( const ExecFlagType exec_flag,
const std::set< TagID > &  vector_tags_to_close 
)
overridevirtualinherited

Quit the current solve as soon as possible.

Implements SolverSystem.

Definition at line 213 of file NonlinearSystem.C.

215 {
216  PetscNonlinearSolver<Real> & solver =
218 
219  if (exec_flag == EXEC_LINEAR || exec_flag == EXEC_POSTCHECK)
220  {
221  LibmeshPetscCall(SNESSetFunctionDomainError(solver.snes()));
222 
223  // Clean up by getting vectors into a valid state for a
224  // (possible) subsequent solve.
225  closeTaggedVectors(vector_tags_to_close);
226  }
227  else if (exec_flag == EXEC_NONLINEAR)
228  LibmeshPetscCall(SNESSetJacobianDomainError(solver.snes()));
229  else
230  mooseError("Unsupported execute flag: ", Moose::stringify(exec_flag));
231 }
SNES snes(const char *name=nullptr)
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual libMesh::NonlinearImplicitSystem & sys()
const ExecFlagType EXEC_LINEAR
Definition: Moose.C:31
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:668
const ExecFlagType EXEC_POSTCHECK
Definition: Moose.C:35
const ExecFlagType EXEC_NONLINEAR
Definition: Moose.C:33

◆ subdomainSetup() [1/3]

void SystemBase::subdomainSetup
inherited

Definition at line 1581 of file SystemBase.C.

1582 {
1583  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1584  _vars[tid].subdomainSetup();
1585 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
virtual void subdomainSetup()
Definition: SystemBase.C:1581
unsigned int THREAD_ID
Definition: MooseTypes.h:237

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

1034 {
1036 
1037  _kernels.subdomainSetup(subdomain, tid);
1038  _nodal_kernels.subdomainSetup(subdomain, tid);
1039  _element_dampers.subdomainSetup(subdomain, tid);
1040  _nodal_dampers.subdomainSetup(subdomain, tid);
1041 }
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:1581
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 1581 of file SystemBase.C.

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

1582 {
1583  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1584  _vars[tid].subdomainSetup();
1585 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
virtual void subdomainSetup()
Definition: SystemBase.C:1581
unsigned int THREAD_ID
Definition: MooseTypes.h:237

◆ subproblem() [1/2]

SubProblem& SystemBase::subproblem ( )
inlineinherited

◆ subproblem() [2/2]

const SubProblem& SystemBase::subproblem ( ) const
inlineinherited

Definition at line 103 of file SystemBase.h.

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

◆ sys()

virtual libMesh::NonlinearImplicitSystem& NonlinearSystem::sys ( )
inlinevirtualinherited

Definition at line 67 of file NonlinearSystem.h.

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

67 { return _nl_implicit_sys; }
libMesh::NonlinearImplicitSystem & _nl_implicit_sys

◆ system() [1/2]

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

Get the reference to the libMesh system.

Implements SystemBase.

Definition at line 700 of file NonlinearSystemBase.h.

Referenced by PhysicsBasedPreconditioner::addSystem(), PhysicsBasedPreconditioner::apply(), FEProblemBase::computeJacobianTags(), FEProblemBase::computeResidualAndJacobian(), NonlinearSystemBase::computeScaling(), PseudoTimestep::currentResidualNorm(), DMMooseFunction(), DMMooseJacobian(), VariableResidual::execute(), NonlinearSystemBase::getResidualNonTimeVector(), NonlinearSystemBase::getResidualTimeVector(), NonlinearSystem::getSNES(), ExplicitTimeIntegrator::initialSetup(), ReferenceResidualConvergence::initialSetup(), MooseStaticCondensationPreconditioner::MooseStaticCondensationPreconditioner(), Moose::PetscSupport::petscSetDefaults(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), ComputeJacobianThread::postElement(), NonlinearSystemBase::residualGhosted(), Moose::PetscSupport::setLineSearchFromParams(), PhysicsBasedPreconditioner::setup(), NonlinearSystemBase::setupScalingData(), SingleMatrixPreconditioner::SingleMatrixPreconditioner(), NonlinearSystem::solve(), NonlinearEigenSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), FieldSplitPreconditioner::system(), NonlinearSystemBase::turnOffJacobian(), ReferenceResidualConvergence::updateReferenceResidual(), VariableCondensationPreconditioner::VariableCondensationPreconditioner(), and Console::writeVariableNorms().

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

◆ system() [2/2]

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

Implements SystemBase.

Definition at line 701 of file NonlinearSystemBase.h.

701 { return _sys; }
libMesh::System & _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 55 of file PerfGraphInterface.C.

Referenced by PerfGraphInterface::registerTimedSection().

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

◆ timeKernelVariableNames()

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

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

Implements SolverSystem.

Definition at line 3880 of file NonlinearSystemBase.C.

3881 {
3882  std::vector<std::string> variable_names;
3883  const auto & time_kernels = _kernels.getVectorTagObjectWarehouse(timeVectorTag(), 0);
3884  if (time_kernels.hasActiveObjects())
3885  for (const auto & kernel : time_kernels.getObjects())
3886  variable_names.push_back(kernel->variable().name());
3887 
3888  return variable_names;
3889 }
MooseObjectTagWarehouse< KernelBase > _kernels
TagID timeVectorTag() const override
Ideally, we should not need this API.
MooseObjectWarehouse< T > & getVectorTagObjectWarehouse(TagID tag_id, THREAD_ID tid)
Retrieve a moose object warehouse in which every moose object has the given vector tag...

◆ timestepSetup()

void NonlinearSystemBase::timestepSetup ( )
overridevirtualinherited

Reimplemented from SystemBase.

Definition at line 337 of file NonlinearSystemBase.C.

338 {
340 
341  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
342  {
343  _kernels.timestepSetup(tid);
346  if (_doing_dg)
352 
353  if (_fe_problem.haveFV())
354  {
355  std::vector<FVFluxBC *> bcs;
357  .query()
358  .template condition<AttribSystem>("FVFluxBC")
359  .template condition<AttribThread>(tid)
360  .queryInto(bcs);
361 
362  std::vector<FVInterfaceKernel *> iks;
364  .query()
365  .template condition<AttribSystem>("FVInterfaceKernel")
366  .template condition<AttribThread>(tid)
367  .queryInto(iks);
368 
369  std::vector<FVFluxKernel *> kernels;
371  .query()
372  .template condition<AttribSystem>("FVFluxKernel")
373  .template condition<AttribThread>(tid)
374  .queryInto(kernels);
375 
376  for (auto * bc : bcs)
377  bc->timestepSetup();
378  for (auto * ik : iks)
379  ik->timestepSetup();
380  for (auto * kernel : kernels)
381  kernel->timestepSetup();
382  }
383  }
390 
391 #ifdef MOOSE_KOKKOS_ENABLED
396 #endif
397 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_kernels
unsigned int n_threads()
MooseObjectTagWarehouse< ResidualObject > _kokkos_kernels
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:312
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)
MooseObjectWarehouse< DirichletBCBase > _preset_nodal_bcs
TheWarehouse & theWarehouse() const
virtual void timestepSetup(THREAD_ID tid=0) const
MooseObjectTagWarehouse< KernelBase > _kernels
ConstraintWarehouse _constraints
Constraints storage object.
MooseObjectTagWarehouse< ResidualObject > _kokkos_integrated_bcs
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
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:467
MooseObjectTagWarehouse< InterfaceKernelBase > _interface_kernels
MooseObjectWarehouse< GeneralDamper > _general_dampers
General Dampers.
MooseObjectTagWarehouse< IntegratedBCBase > _integrated_bcs
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
unsigned int THREAD_ID
Definition: MooseTypes.h:237
virtual void timestepSetup()
Definition: SystemBase.C:1567
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

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

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

709 { 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 219 of file NonlinearSystemBase.C.

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

◆ update()

void SystemBase::update ( )
inherited

◆ updateActive()

void NonlinearSystemBase::updateActive ( THREAD_ID  tid)
inherited

Update active objects of Warehouses owned by NonlinearSystemBase.

Definition at line 3394 of file NonlinearSystemBase.C.

3395 {
3402  _kernels.updateActive(tid);
3404 
3405  if (tid == 0)
3406  {
3414 
3415 #ifdef MOOSE_KOKKOS_ENABLED
3421 #endif
3422  }
3423 }
MooseObjectTagWarehouse< NodalKernelBase > _nodal_kernels
NodalKernels for each thread.
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_kernels
MooseObjectTagWarehouse< ResidualObject > _kokkos_kernels
MooseObjectTagWarehouse< DGKernelBase > _dg_kernels
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
MooseObjectWarehouseBase< Split > _splits
Decomposition splits.
MooseObjectWarehouse< NodalDamper > _nodal_dampers
Nodal Dampers for each thread.
void updateActive(THREAD_ID tid=0) override
Update the various active lists.
MooseObjectWarehouse< ResidualObject > _kokkos_preset_nodal_bcs
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.
MooseObjectTagWarehouse< ResidualObject > _kokkos_integrated_bcs
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
virtual void updateActive(THREAD_ID tid=0)
Updates the active objects storage.
MooseObjectTagWarehouse< ResidualObject > _kokkos_nodal_bcs
MooseObjectTagWarehouse< ScalarKernelBase > _scalar_kernels
MooseObjectWarehouse< ADDirichletBCBase > _ad_preset_nodal_bcs

◆ useFieldSplitPreconditioner()

void NonlinearSystemBase::useFieldSplitPreconditioner ( FieldSplitPreconditionerBase fsp)
inlineinherited

If called with a non-null object true this system will use a field split preconditioner matrix.

Definition at line 499 of file NonlinearSystemBase.h.

Referenced by FieldSplitPreconditionerTempl< MoosePreconditioner >::FieldSplitPreconditionerTempl().

499 { _fsp = fsp; }
FieldSplitPreconditionerBase * _fsp
The field split preconditioner if this sytem is using one.

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

Referenced by FiniteDifferencePreconditioner::FiniteDifferencePreconditioner().

492  {
494  }
bool _use_finite_differenced_preconditioner
Whether or not to use a finite differenced preconditioner.

◆ usePreSMOResidual()

const bool& NonlinearSystemBase::usePreSMOResidual ( ) const
inlineinherited

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

Definition at line 289 of file NonlinearSystemBase.h.

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

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

◆ validParams()

InputParameters PerfGraphInterface::validParams ( )
staticinherited

Definition at line 16 of file PerfGraphInterface.C.

Referenced by Convergence::validParams().

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

◆ variableWarehouse()

const VariableWarehouse& SystemBase::variableWarehouse ( THREAD_ID  tid = 0) const
inlineinherited

Definition at line 757 of file SystemBase.h.

757 { return _vars[tid]; }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996

◆ varKind()

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

Definition at line 927 of file SystemBase.h.

Referenced by Coupleable::coupled().

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

◆ zeroTaggedVector()

void SystemBase::zeroTaggedVector ( const TagID  tag)
inherited

Zero vector with the given tag.

Definition at line 675 of file SystemBase.C.

Referenced by SystemBase::zeroTaggedVectors().

676 {
677  if (!_subproblem.vectorTagExists(tag))
678  mooseError("Cannot zero vector with TagID ",
679  tag,
680  " in system '",
681  name(),
682  "' because that tag does not exist in the problem");
683  else if (!hasVector(tag))
684  mooseError("Cannot zero vector tag with name '",
686  "' in system '",
687  name(),
688  "' because there is no vector associated with that tag");
690  getVector(tag).zero();
691 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:925
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
bool vectorTagNotZeroed(const TagID tag) const
Checks if a vector tag is in the list of vectors that will not be zeroed when other tagged vectors ar...
Definition: SubProblem.C:156
virtual void zero()=0
virtual const std::string & name() const
Definition: SystemBase.C:1342
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
Definition: SubProblem.h:201
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
Definition: SubProblem.C:222
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:934

◆ zeroTaggedVectors()

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

Zero all vectors for given tags.

Definition at line 694 of file SystemBase.C.

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

695 {
696  for (const auto tag : tags)
697  zeroTaggedVector(tag);
698 }
void zeroTaggedVector(const TagID tag)
Zero vector with the given tag.
Definition: SystemBase.C:675

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

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

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

◆ zeroVariablesForJacobian()

void SystemBase::zeroVariablesForJacobian ( )
virtualinherited

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

Definition at line 236 of file SystemBase.C.

237 {
239 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:1003
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:201

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

231 {
233 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:1002
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:201

◆ zeroVectorForResidual()

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

Definition at line 798 of file NonlinearSystemBase.C.

799 {
800  for (unsigned int i = 0; i < _vecs_to_zero_for_residual.size(); ++i)
801  if (vector_name == _vecs_to_zero_for_residual[i])
802  return;
803 
804  _vecs_to_zero_for_residual.push_back(vector_name);
805 }
std::vector< std::string > _vecs_to_zero_for_residual
vectors that will be zeroed before a residual computation

Member Data Documentation

◆ _active_on_old

bool MooseEigenSystem::_active_on_old
protected

Definition at line 106 of file MooseEigenSystem.h.

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

◆ _active_tagged_matrices

std::unordered_map<TagID, libMesh::SparseMatrix<Number> *> SystemBase::_active_tagged_matrices
protectedinherited

Active tagged matrices. A matrix is active if its tag-matrix pair is present in the map. We use a map instead of a vector so that users can easily add and remove to this container with calls to (de)activateMatrixTag.

Definition at line 1025 of file SystemBase.h.

Referenced by SystemBase::activateAllMatrixTags(), SystemBase::deactivateAllMatrixTags(), and SystemBase::reinitElem().

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

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

◆ _all_eigen_vars

bool MooseEigenSystem::_all_eigen_vars
protected

◆ _app

MooseApp& SystemBase::_app
protectedinherited

◆ _assemble_constraints_separately

bool NonlinearSystemBase::_assemble_constraints_separately
protectedinherited

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

Definition at line 1002 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 1055 of file SystemBase.h.

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

◆ _compute_scaling_once

bool NonlinearSystemBase::_compute_scaling_once
protectedinherited

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

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

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

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

◆ _computing_pre_smo_residual

bool NonlinearSystemBase::_computing_pre_smo_residual
protectedinherited

◆ _console

const ConsoleStream ConsoleStreamInterface::_console
inherited

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

Definition at line 31 of file ConsoleStreamInterface.h.

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

◆ _constraints

ConstraintWarehouse NonlinearSystemBase::_constraints
protectedinherited

◆ _current_l_its

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

◆ _current_nl_its

unsigned int NonlinearSystemBase::_current_nl_its
inherited

◆ _current_solution

const NumericVector<Number>* SolverSystem::_current_solution
protectedinherited

◆ _debugging_residuals

bool NonlinearSystemBase::_debugging_residuals
protectedinherited

true if debugging residuals

Definition at line 1007 of file NonlinearSystemBase.h.

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

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

◆ _du_dotdot_du

Number NonlinearSystemBase::_du_dotdot_du
protectedinherited

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

Definition at line 908 of file NonlinearSystemBase.h.

◆ _eigen_kernel_counter

unsigned int MooseEigenSystem::_eigen_kernel_counter
protected

counter of eigen kernels

Definition at line 109 of file MooseEigenSystem.h.

Referenced by addKernel(), and containsEigenKernel().

◆ _eigen_var_indices

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

◆ _eigen_var_names

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

Definition at line 102 of file MooseEigenSystem.h.

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

◆ _element_dampers

MooseObjectWarehouse<ElementDamper> NonlinearSystemBase::_element_dampers
protectedinherited

◆ _factory

Factory& SystemBase::_factory
protectedinherited

◆ _fd_residual_functor

ComputeFDResidualFunctor NonlinearSystem::_fd_residual_functor
protectedinherited

◆ _fdcoloring

MatFDColoring NonlinearSystemBase::_fdcoloring
protectedinherited

◆ _fe_problem

FEProblemBase& SystemBase::_fe_problem
protectedinherited

the governing finite element/volume problem

Definition at line 986 of file SystemBase.h.

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

◆ _final_residual

Real NonlinearSystemBase::_final_residual
protectedinherited

◆ _fixed_point_relaxation_factor

Real SolverSystem::_fixed_point_relaxation_factor = 1.0
protectedinherited

Used for relaxing entire system solution during fixed point (multi-)system iterations.

Definition at line 131 of file SolverSystem.h.

Referenced by SolverSystem::applyFixedPointRelaxation(), SolverSystem::clearFixedPointRelaxation(), SolverSystem::saveOldSolutionForFixedPointRelaxation(), and SolverSystem::setFixedPointRelaxationFactor().

◆ _fsp

FieldSplitPreconditionerBase* NonlinearSystemBase::_fsp
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

◆ _has_save_in

bool NonlinearSystemBase::_has_save_in
protectedinherited

◆ _hybridized_kernels

MooseObjectTagWarehouse<HDGKernel> NonlinearSystemBase::_hybridized_kernels
protectedinherited

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

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

◆ _increment_vec

NumericVector<Number>* NonlinearSystemBase::_increment_vec
protectedinherited

◆ _initial_residual

Real NonlinearSystemBase::_initial_residual
protectedinherited

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

Definition at line 1031 of file NonlinearSystemBase.h.

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

◆ _integrated_bcs

MooseObjectTagWarehouse<IntegratedBCBase> NonlinearSystemBase::_integrated_bcs
protectedinherited

◆ _interface_kernels

MooseObjectTagWarehouse<InterfaceKernelBase> NonlinearSystemBase::_interface_kernels
protectedinherited

◆ _Ke_non_time_tag

TagID NonlinearSystemBase::_Ke_non_time_tag
protectedinherited

Tag for non-time contribution Jacobian.

Definition at line 931 of file NonlinearSystemBase.h.

◆ _Ke_system_tag

TagID NonlinearSystemBase::_Ke_system_tag
protectedinherited

Tag for system contribution Jacobian.

Definition at line 934 of file NonlinearSystemBase.h.

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

◆ _kernels

MooseObjectTagWarehouse<KernelBase> NonlinearSystemBase::_kernels
protectedinherited

◆ _kokkos_integrated_bcs

MooseObjectTagWarehouse<ResidualObject> NonlinearSystemBase::_kokkos_integrated_bcs
protectedinherited

◆ _kokkos_kernels

MooseObjectTagWarehouse<ResidualObject> NonlinearSystemBase::_kokkos_kernels
protectedinherited

◆ _kokkos_nodal_bcs

MooseObjectTagWarehouse<ResidualObject> NonlinearSystemBase::_kokkos_nodal_bcs
protectedinherited

◆ _kokkos_nodal_kernels

MooseObjectTagWarehouse<ResidualObject> NonlinearSystemBase::_kokkos_nodal_kernels
protectedinherited

◆ _kokkos_preset_nodal_bcs

MooseObjectWarehouse<ResidualObject> NonlinearSystemBase::_kokkos_preset_nodal_bcs
protectedinherited

◆ _ksp_norm

Moose::MooseKSPNormType SolverSystem::_ksp_norm
protectedinherited

KSP norm type.

Definition at line 125 of file SolverSystem.h.

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

◆ _last_nl_rnorm

Real NonlinearSystemBase::_last_nl_rnorm
inherited

◆ _matrix_tag_active_flags

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

Active flags for tagged matrices.

Definition at line 1027 of file SystemBase.h.

Referenced by SystemBase::activateAllMatrixTags(), SystemBase::deactivateAllMatrixTags(), and SystemBase::matrixTagActive().

◆ _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 1043 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 1046 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 1000 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 1019 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 993 of file SystemBase.h.

◆ _need_residual_ghosted

bool NonlinearSystemBase::_need_residual_ghosted
protectedinherited

◆ _nl_implicit_sys

libMesh::NonlinearImplicitSystem& NonlinearSystem::_nl_implicit_sys
protectedinherited

◆ _nl_matrix_tags

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

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

Definition at line 917 of file NonlinearSystemBase.h.

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

◆ _nl_residual_functor

ComputeResidualFunctor NonlinearSystem::_nl_residual_functor
protectedinherited

Definition at line 80 of file NonlinearSystem.h.

Referenced by NonlinearSystem::NonlinearSystem().

◆ _nl_vector_tags

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

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

Definition at line 914 of file NonlinearSystemBase.h.

Referenced by 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 596 of file NonlinearSystemBase.h.

◆ _numbered_vars

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

Map variable number to its pointer.

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

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

◆ _pc_side

Moose::PCSideType SolverSystem::_pc_side
protectedinherited

Preconditioning side.

Definition at line 123 of file SolverSystem.h.

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

◆ _pg_moose_app

MooseApp& PerfGraphInterface::_pg_moose_app
protectedinherited

The MooseApp that owns the PerfGraph.

Definition at line 135 of file PerfGraphInterface.h.

Referenced by PerfGraphInterface::perfGraph().

◆ _pre_smo_residual

Real NonlinearSystemBase::_pre_smo_residual
protectedinherited

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

Definition at line 1029 of file NonlinearSystemBase.h.

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

◆ _preconditioner

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

◆ _predictor

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

◆ _prefix

const std::string PerfGraphInterface::_prefix
protectedinherited

A prefix to use for all sections.

Definition at line 138 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 1035 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 928 of file NonlinearSystemBase.h.

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

◆ _Re_time

NumericVector<Number>* NonlinearSystemBase::_Re_time
protectedinherited

◆ _Re_time_tag

TagID NonlinearSystemBase::_Re_time_tag
protectedinherited

◆ _resid_and_jac_functor

ComputeResidualAndJacobian NonlinearSystem::_resid_and_jac_functor
protectedinherited

Definition at line 82 of file NonlinearSystem.h.

Referenced by NonlinearSystem::residualAndJacobianTogether().

◆ _resid_vs_jac_scaling_param

Real NonlinearSystemBase::_resid_vs_jac_scaling_param
protectedinherited

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

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

Definition at line 1062 of file NonlinearSystemBase.h.

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

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

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

◆ _residual_ghosted

NumericVector<Number>* NonlinearSystemBase::_residual_ghosted
protectedinherited

◆ _saved_dot_old

NumericVector<Real>* SystemBase::_saved_dot_old
protectedinherited

Definition at line 1034 of file SystemBase.h.

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

◆ _saved_dotdot_old

NumericVector<Real>* SystemBase::_saved_dotdot_old
protectedinherited

Definition at line 1035 of file SystemBase.h.

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

◆ _saved_old

NumericVector<Real>* SystemBase::_saved_old
protectedinherited

Definition at line 1030 of file SystemBase.h.

◆ _saved_older

NumericVector<Real>* SystemBase::_saved_older
protectedinherited

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

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

◆ _scaling_matrix

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

◆ _serialized_solution

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

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

Definition at line 1068 of file SystemBase.h.

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

◆ _solution_is_invalid

bool SolverSystem::_solution_is_invalid
protectedinherited

Boolean to see if solution is invalid.

Definition at line 128 of file SolverSystem.h.

◆ _solution_states_initialized

bool SystemBase::_solution_states_initialized
protectedinherited

Whether or not the solution states have been initialized.

Definition at line 1061 of file SystemBase.h.

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

◆ _splits

MooseObjectWarehouseBase<Split> NonlinearSystemBase::_splits
protectedinherited

◆ _subproblem

SubProblem& SystemBase::_subproblem
protectedinherited

◆ _sys

libMesh::System& NonlinearSystemBase::_sys
inherited

◆ _tagged_matrices

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

◆ _tagged_vectors

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

◆ _time_integrators

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

◆ _u_dot

NumericVector<Number>* SystemBase::_u_dot
protectedinherited

solution vector for u^dot

Definition at line 1006 of file SystemBase.h.

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

◆ _u_dot_old

NumericVector<Number>* SystemBase::_u_dot_old
protectedinherited

old solution vector for u^dot

Definition at line 1011 of file SystemBase.h.

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

◆ _u_dotdot

NumericVector<Number>* SystemBase::_u_dotdot
protectedinherited

solution vector for u^dotdot

Definition at line 1008 of file SystemBase.h.

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

◆ _u_dotdot_old

NumericVector<Number>* SystemBase::_u_dotdot_old
protectedinherited

old solution vector for u^dotdot

Definition at line 1013 of file SystemBase.h.

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

◆ _use_finite_differenced_preconditioner

bool NonlinearSystemBase::_use_finite_differenced_preconditioner
protectedinherited

◆ _use_pre_smo_residual

bool NonlinearSystemBase::_use_pre_smo_residual
protectedinherited

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

Definition at line 1033 of file NonlinearSystemBase.h.

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

◆ _var_all_dof_indices

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

Container for the dof indices of a given variable.

Definition at line 1064 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 1038 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 998 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 1070 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 996 of file SystemBase.h.

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

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

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


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