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

Linear system to be solved. More...

#include <LinearSystem.h>

Inheritance diagram for LinearSystem:
[legend]

Public Member Functions

 LinearSystem (FEProblemBase &problem, const std::string &name)
 
virtual ~LinearSystem ()
 
virtual void solve () override
 Solve the system (using libMesh magic) More...
 
virtual bool converged () override
 At the moment, this is only used for the multi-system fixed point iteration. More...
 
virtual void initialSetup () override
 Setup Functions. More...
 
virtual void reinit () override
 Reinitialize the system when the degrees of freedom in this system have changed. More...
 
virtual void residualSetup () override
 
virtual void jacobianSetup () override
 
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 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...
 
void computeLinearSystemTags (const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags, const bool compute_gradients=true)
 Compute the right hand side and the system matrix of the system for given tags. More...
 
libMesh::LinearImplicitSystemlinearImplicitSystem ()
 Return a reference to the stored linear implicit system. More...
 
NumericVector< Number > & getRightHandSideTimeVector ()
 Return a numeric vector that is associated with the time tag. More...
 
NumericVector< Number > & getRightHandSideNonTimeVector ()
 Return a numeric vector that is associated with the nontime tag. More...
 
virtual void augmentSparsity (SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz) override
 Will modify the sparsity pattern to add logical geometric connections. More...
 
unsigned int nLinearIterations () const
 Return the number of linear iterations. More...
 
virtual System & system () override
 Get the reference to the libMesh system. More...
 
virtual const System & system () const override
 
NumericVector< Number > & getRightHandSideVector ()
 Fetching the right hand side vector from the libmesh system. More...
 
const NumericVector< Number > & getRightHandSideVector () const
 
SparseMatrix< Number > & getSystemMatrix ()
 Fetching the system matrix from the libmesh system. More...
 
const SparseMatrix< Number > & getSystemMatrix () const
 
virtual void compute (ExecFlagType type) override
 Compute time derivatives, auxiliary variables, etc. More...
 
void computeGradients ()
 Compute and store raw and requested limited Green-Gauss gradients for linear FV variables. More...
 
const std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & linearFVLimitedGradientContainer (const Moose::FV::GradientLimiterType limiter_type) const
 Access the stored raw or limited cell-centered gradient components. More...
 
void requestLinearFVLimitedGradients (const Moose::FV::GradientLimiterType limiter_type, unsigned int variable_number)
 Request storage and assembly of limiter-specific cell gradients. More...
 
virtual void preInit () override
 This is called prior to the libMesh system has been init'd. 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...
 
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 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 TagID timeVectorTag () const
 Ideally, we should not need this API. More...
 
virtual TagID nonTimeVectorTag () const
 
virtual TagID residualVectorTag () const
 
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 NumericVector< Number > & residualCopy ()
 
virtual NumericVector< Number > & residualGhosted ()
 
virtual void augmentSendList (std::vector< dof_id_type > &send_list)
 Will modify the send_list to add all of the extra ghosted dofs for this system. More...
 
virtual void addVariable (const std::string &var_type, const std::string &var_name, InputParameters &parameters)
 Canonical method for adding a variable. More...
 
virtual bool isArrayVariable (const std::string &var_name) const
 If a variable is an array variable. More...
 
virtual bool isScalarVariable (unsigned int var_name) const
 
MooseVariableFieldBasegetVariable (THREAD_ID tid, const std::string &var_name) const
 Gets a reference to a variable of with specified name. More...
 
MooseVariableFieldBasegetVariable (THREAD_ID tid, unsigned int var_number) const
 Gets a reference to a variable with specified number. More...
 
template<typename T >
MooseVariableFE< T > & getFieldVariable (THREAD_ID tid, const std::string &var_name)
 Gets a reference to a variable of with specified name. More...
 
template<typename T >
MooseVariableFE< T > & getFieldVariable (THREAD_ID tid, unsigned int var_number)
 Gets a reference to a variable with specified number. More...
 
template<typename T >
MooseVariableField< T > & getActualFieldVariable (THREAD_ID tid, const std::string &var_name)
 Returns a field variable pointer - this includes finite volume variables. More...
 
template<typename T >
MooseVariableField< T > & getActualFieldVariable (THREAD_ID tid, unsigned int var_number)
 Returns a field variable pointer - this includes finite volume variables. More...
 
template<typename T >
MooseVariableFV< T > & getFVVariable (THREAD_ID tid, const std::string &var_name)
 Return a finite volume variable. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, const std::string &var_name) const
 Gets a reference to a scalar variable with specified number. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, unsigned int var_number) const
 Gets a reference to a variable with specified number. More...
 
virtual const std::set< SubdomainID > * getVariableBlocks (unsigned int var_number)
 Get the block where a variable of this system is defined. More...
 
virtual unsigned int nVariables () const
 Get the number of variables in this system. More...
 
unsigned int nFieldVariables () const
 Get the number of field variables in this system. More...
 
unsigned int nFVVariables () const
 Get the number of finite volume variables in this system. More...
 
std::size_t getMaxVarNDofsPerElem () const
 Gets the maximum number of dofs used by any one variable on any one element. More...
 
std::size_t getMaxVarNDofsPerNode () const
 Gets the maximum number of dofs used by any one variable on any one node. More...
 
void assignMaxVarNDofsPerElem (std::size_t max_dofs)
 assign the maximum element dofs More...
 
void assignMaxVarNDofsPerNode (std::size_t max_dofs)
 assign the maximum node dofs More...
 
virtual void addVariableToZeroOnResidual (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each residual evaluation. More...
 
virtual void addVariableToZeroOnJacobian (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each Jacobian evaluation. More...
 
virtual void zeroVariables (std::vector< std::string > &vars_to_be_zeroed)
 Zero out the solution for the list of variables passed in. More...
 
virtual void zeroVariablesForResidual ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on residual evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual void zeroVariablesForJacobian ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on Jacobian evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual libMesh::Order getMinQuadratureOrder ()
 Get minimal quadrature order needed for integrating variables in this system. More...
 
virtual void prepare (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareFace (THREAD_ID tid, bool resize_data)
 Prepare the system for use on sides. More...
 
virtual void prepareNeighbor (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareLowerD (THREAD_ID tid)
 Prepare the system for use for lower dimensional elements. More...
 
virtual void reinitElem (const Elem *elem, THREAD_ID tid)
 Reinit an element assembly info. More...
 
virtual void reinitElemFace (const Elem *elem, unsigned int side, THREAD_ID tid)
 Reinit assembly info for a side of an element. More...
 
virtual void reinitNeighborFace (const Elem *elem, unsigned int side, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitNeighbor (const Elem *elem, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitLowerD (THREAD_ID tid)
 Compute the values of the variables on the lower dimensional element. More...
 
virtual void reinitNode (const Node *node, THREAD_ID tid)
 Reinit nodal assembly info. More...
 
virtual void reinitNodeFace (const Node *node, BoundaryID bnd_id, THREAD_ID tid)
 Reinit nodal assembly info on a face. More...
 
virtual void reinitNodes (const std::vector< dof_id_type > &nodes, THREAD_ID tid)
 Reinit variables at a set of nodes. More...
 
virtual void reinitNodesNeighbor (const std::vector< dof_id_type > &nodes, THREAD_ID tid)
 Reinit variables at a set of neighbor nodes. More...
 
virtual void reinitScalars (THREAD_ID tid, bool reinit_for_derivative_reordering=false)
 Reinit scalar varaibles. More...
 
virtual void addVariableToCopy (const std::string &dest_name, const std::string &source_name, const std::string &timestep)
 Add info about variable that will be copied. More...
 
const std::vector< MooseVariableFieldBase * > & getVariables (THREAD_ID tid)
 
const 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...
 
virtual void timestepSetup ()
 
virtual void customSetup (const ExecFlagType &exec_type)
 
virtual void subdomainSetup ()
 
void clearAllDofIndices ()
 Clear all dof indices from moose variables. More...
 
void setActiveVariableCoupleableVectorTags (const std::set< TagID > &vtags, THREAD_ID tid)
 Set the active vector tags for the variables. More...
 
void setActiveScalarVariableCoupleableVectorTags (const std::set< TagID > &vtags, THREAD_ID tid)
 Set the active vector tags for the scalar variables. More...
 
Moose::VarKindType varKind () const
 
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...
 
const std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & linearFVGradientContainer () const
 Access the stored raw cell-centered gradient components. More...
 
void requestLinearFVLimitedGradients (const Moose::FV::GradientLimiterType limiter_type, unsigned int variable_number)
 Request storage and assembly of limiter-specific cell gradients. More...
 
const std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & linearFVLimitedGradientContainer (const Moose::FV::GradientLimiterType limiter_type) const
 Access the stored raw or limited cell-centered gradient components. More...
 
const std::unordered_set< Moose::FV::GradientLimiterType > & requestedLinearFVLimitedGradientTypes () const
 Access the limiter types requested for this system. More...
 
TagID rightHandSideTimeVectorTag () const
 
TagID rightHandSideNonTimeVectorTag () const
 
TagID rightHandSideVectorTag () const
 
virtual TagID systemMatrixTag () const override
 Return the Matrix Tag ID for System. More...
 
virtual NumericVector< Number > & getVector (const std::string &name)
 Get a raw NumericVector by name. More...
 
virtual const NumericVector< Number > & getVector (const std::string &name) const
 
virtual NumericVector< Number > & getVector (TagID tag)
 Get a raw NumericVector by tag. More...
 
virtual const NumericVector< Number > & getVector (TagID tag) const
 
virtual bool hasVariable (const std::string &var_name) const
 Query a system for a variable. More...
 
virtual bool hasScalarVariable (const std::string &var_name) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Public Attributes

const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 

Protected Member Functions

void computeLinearSystemInternal (const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags, const bool compute_gradients=true)
 Compute the right hand side and system matrix for given tags. More...
 
void checkInvalidSolution ()
 
virtual NumericVector< Number > & solutionInternal () const override final
 Internal getter for solution owned by libMesh. More...
 
virtual bool matrixFromColoring () const
 Whether a system matrix is formed from coloring. More...
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 Call to register a named section for timing. More...
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 Call to register a named section for timing. More...
 
std::string timedSectionName (const std::string &section_name) const
 
void computeGradients ()
 Compute and store raw and requested limited Green-Gauss gradients for linear FV variables. More...
 
void rebuildLinearFVGradientStorage ()
 Rebuild persistent raw and temporary gradient storage after mesh/DOF changes. More...
 
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & temporaryLinearFVGradientContainer ()
 Return temporary storage for gradients during gradient assembly. More...
 
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & temporaryLinearFVLimitedGradientContainer (const Moose::FV::GradientLimiterType limiter_type)
 Return temporary storage for limited gradients during gradient assembly. More...
 
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & rawLinearFVLimitedGradientContainer (const Moose::FV::GradientLimiterType limiter_type)
 Access the persisted limited-gradient storage for a specific limiter. More...
 
const std::unordered_set< unsigned int > & requestedLinearFVLimitedGradientVariables (const Moose::FV::GradientLimiterType limiter_type) const
 Access the variable numbers that requested limited gradients for a specific limiter. More...
 
bool needsLinearFVGradientStorage () const
 
void initializeContainer (std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number >>> &container) const
 

Protected Attributes

System & _sys
 Base class reference to the libmesh system. More...
 
unsigned int _current_l_its
 The linear iterations needed for convergence. More...
 
std::set< TagID_vector_tags
 Vector tags to temporarily store all tags associated with the current system. More...
 
std::set< TagID_matrix_tags
 Matrix tags to temporarily store all tags associated with the current system. More...
 
TagID _rhs_time_tag
 Tag for time contribution rhs. More...
 
NumericVector< Number > * _rhs_time
 right hand side vector for time contributions More...
 
TagID _rhs_non_time_tag
 Tag for non-time contribution rhs. More...
 
NumericVector< Number > * _rhs_non_time
 right hand side vector for non-time contributions More...
 
TagID _rhs_tag
 Used for the right hand side vector from PETSc. More...
 
TagID _system_matrix_non_time_tag
 Tag for non-time contribution to the system matrix. More...
 
TagID _system_matrix_tag
 Tag for every contribution to system matrix. More...
 
unsigned int _n_linear_iters
 Number of linear iterations. More...
 
Real _initial_linear_residual
 The initial linear residual. More...
 
Real _final_linear_residual
 The final linear residual. More...
 
bool _converged
 If the solve on the linear system converged. More...
 
libMesh::LinearImplicitSystem_linear_implicit_system
 Base class reference to the linear implicit system in libmesh. 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< Real_du_dot_du
 Derivative of time derivative of u with respect to uj. More...
 
Real _du_dotdot_du
 
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...
 
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _temporary_gradient
 Scratch storage for raw gradients assembled during the current compute pass. More...
 
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
 Persisted raw cell-centered gradient components keyed by spatial direction. More...
 
std::unordered_set< Moose::FV::GradientLimiterType_requested_limited_gradient_types
 Set of requested limiter types for which limited gradients should be computed. More...
 
std::unordered_map< Moose::FV::GradientLimiterType, std::unordered_set< unsigned int > > _requested_limited_gradient_variables
 Variable numbers requesting limited gradients, keyed by limiter type. More...
 
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _raw_limited_grad_containers
 Persisted limited gradient components keyed by limiter type. More...
 
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _temporary_limited_gradient
 Scratch storage for limited gradients assembled during the current compute pass. More...
 

Private Attributes

std::vector< NumericVector< Number > * > _solution_state
 The current states of the solution (0 = current, 1 = old, etc) More...
 

Detailed Description

Linear system to be solved.

Definition at line 39 of file LinearSystem.h.

Constructor & Destructor Documentation

◆ LinearSystem()

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

Definition at line 78 of file LinearSystem.C.

79  : SolverSystem(fe_problem, fe_problem, name, Moose::VAR_SOLVER),
80  PerfGraphInterface(fe_problem.getMooseApp().perfGraph(), "LinearSystem"),
81  LinearFVGradientInterface(static_cast<SystemBase &>(*this)),
82  _sys(fe_problem.es().add_system<LinearImplicitSystem>(name)),
83  _rhs_time_tag(-1),
84  _rhs_time(NULL),
86  _rhs_non_time(NULL),
87  _n_linear_iters(0),
88  _converged(false),
89  _linear_implicit_system(fe_problem.es().get_system<LinearImplicitSystem>(name))
90 {
92  // Don't need to add the matrix - it already exists. Well, technically it will exist
93  // after the initialization. Right now it is just a nullpointer. We will just make sure
94  // we associate the tag with the system matrix for now.
96 
97  // We create a tag for the right hand side, the vector is already in the libmesh system
100 
102 }
SolverSystem(SubProblem &subproblem, FEProblemBase &fe_problem, const std::string &name, Moose::VarKindType var_kind)
Definition: SolverSystem.C:18
unsigned int _n_linear_iters
Number of linear iterations.
Definition: LinearSystem.h:188
NumericVector< Number > & getRightHandSideNonTimeVector()
Return a numeric vector that is associated with the nontime tag.
Definition: LinearSystem.C:265
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:93
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:982
void compute_linear_system(libMesh::EquationSystems &es, const std::string &system_name)
Definition: LinearSystem.C:67
NumericVector< Number > * rhs
friend class LinearFVGradientInterface
System & _sys
Base class reference to the libmesh system.
Definition: LinearSystem.h:155
virtual const std::string & name() const
Definition: SystemBase.C:1342
libMesh::LinearImplicitSystem & _linear_implicit_system
Base class reference to the linear implicit system in libmesh.
Definition: LinearSystem.h:200
NumericVector< Number > * _rhs_time
right hand side vector for time contributions
Definition: LinearSystem.h:170
virtual TagID addMatrixTag(TagName tag_name)
Create a Tag.
Definition: SubProblem.C:312
TagID _rhs_tag
Used for the right hand side vector from PETSc.
Definition: LinearSystem.h:179
void attach_assemble_function(void fptr(EquationSystems &es, const std::string &name))
TagID _rhs_non_time_tag
Tag for non-time contribution rhs.
Definition: LinearSystem.h:173
TagID _rhs_time_tag
Tag for time contribution rhs.
Definition: LinearSystem.h:167
TagID _system_matrix_tag
Tag for every contribution to system matrix.
Definition: LinearSystem.h:185
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
bool _converged
If the solve on the linear system converged.
Definition: LinearSystem.h:197
NumericVector< Number > * _rhs_non_time
right hand side vector for non-time contributions
Definition: LinearSystem.h:176
PerfGraphInterface(const MooseObject *moose_object)
For objects that are MooseObjects with a default prefix of type()

◆ ~LinearSystem()

LinearSystem::~LinearSystem ( )
virtualdefault

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

◆ 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

◆ 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

◆ 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

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

◆ 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(), 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

◆ 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:3272
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 LinearSystem::augmentSparsity ( SparsityPattern::Graph sparsity,
std::vector< dof_id_type > &  n_nz,
std::vector< dof_id_type > &  n_oz 
)
overridevirtual

Will modify the sparsity pattern to add logical geometric connections.

Implements SystemBase.

Definition at line 271 of file LinearSystem.C.

274 {
275  mooseError("LinearSystem does not support AugmentSparsity!");
276 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ 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

◆ checkInvalidSolution()

void SolverSystem::checkInvalidSolution ( )
protectedinherited

Definition at line 165 of file SolverSystem.C.

Referenced by NonlinearSystem::solve(), and 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:183
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.

◆ 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(), 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 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

◆ compute()

void LinearSystem::compute ( ExecFlagType  type)
overridevirtual

Compute time derivatives, auxiliary variables, etc.

Parameters
typeOur current execution stage

Reimplemented from SolverSystem.

Definition at line 337 of file LinearSystem.C.

338 {
339  // - Linear system assembly is associated with EXEC_NONLINEAR
340  // - Avoid division by 0 dt
341  if (type == EXEC_NONLINEAR && _fe_problem.dt() > 0.)
342  for (auto & ti : _time_integrators)
343  // Do things like compute integration weights
344  ti->preStep();
345 }
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
Definition: SystemBase.h:1049
const ExecFlagType EXEC_NONLINEAR
Definition: Moose.C:33
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual Real & dt() const

◆ computeGradients() [1/2]

void LinearFVGradientInterface::computeGradients ( )
protectedinherited

Compute and store raw and requested limited Green-Gauss gradients for linear FV variables.

Definition at line 27 of file LinearFVGradientInterface.C.

Referenced by AuxiliarySystem::compute(), and computeLinearSystemInternal().

28 {
29  // No gradients have been requested, by now we should have set up the
30  // containers to receive the gradients. Time to early return.
31  if (_raw_grad_container.empty())
32  return;
33 
34  auto & temporary_gradient = temporaryLinearFVGradientContainer();
35  mooseAssert(temporary_gradient.size() == _raw_grad_container.size(),
36  "Temporary and raw gradient containers must have the same size.");
37  for (auto & vec : temporary_gradient)
38  vec->zero();
39 
40  auto & fe_problem = _sys.feProblem();
41  auto * const perf_graph_interface = dynamic_cast<PerfGraphInterface *>(&_sys);
42  mooseAssert(perf_graph_interface,
43  "LinearFVGradientInterface requires its owning system to implement "
44  "PerfGraphInterface.");
45  const auto perf_id = perf_graph_interface->registerTimedSection("LinearVariableFV_Gradients", 3);
46  mooseAssert(!Threads::in_threads, "PerfGraph timing cannot be used within threaded sections");
47  PerfGuard time_guard(perf_graph_interface->perfGraph(), perf_id);
48 
49  PARALLEL_TRY
50  {
52  FaceInfoRange face_info_range(fe_problem.mesh().ownedFaceInfoBegin(),
53  fe_problem.mesh().ownedFaceInfoEnd());
54 
56  fe_problem, _sys, temporary_gradient);
57  Threads::parallel_reduce(face_info_range, gradient_face_thread);
58  }
59  fe_problem.checkExceptionAndStopSolve();
60 
61  for (auto & vec : temporary_gradient)
62  vec->close();
63 
64  PARALLEL_TRY
65  {
67  ElemInfoRange elem_info_range(fe_problem.mesh().ownedElemInfoBegin(),
68  fe_problem.mesh().ownedElemInfoEnd());
69 
70  ComputeLinearFVGreenGaussGradientVolumeThread gradient_volume_thread(
71  fe_problem, _sys, temporary_gradient);
72  Threads::parallel_reduce(elem_info_range, gradient_volume_thread);
73  }
74  fe_problem.checkExceptionAndStopSolve();
75 
76  for (const auto i : index_range(_raw_grad_container))
77  temporary_gradient[i]->close();
78 
79  _raw_grad_container.swap(temporary_gradient);
80 
82  {
84  ElemInfoRange elem_info_range(fe_problem.mesh().ownedElemInfoBegin(),
85  fe_problem.mesh().ownedElemInfoEnd());
86 
87  for (const auto limiter_type : requestedLinearFVLimitedGradientTypes())
88  {
89  if (limiter_type == Moose::FV::GradientLimiterType::None)
90  continue;
91 
92  auto & raw_container = rawLinearFVLimitedGradientContainer(limiter_type);
93  auto & temporary_container = temporaryLinearFVLimitedGradientContainer(limiter_type);
94  mooseAssert(temporary_container.size() == raw_container.size(),
95  "Temporary and raw limited gradient containers must have the same size.");
96  for (auto & vec : temporary_container)
97  vec->zero();
98 
99  PARALLEL_TRY
100  {
101  ComputeLinearFVLimitedGradientThread limited_gradient_thread(
102  fe_problem,
103  _sys,
105  temporary_container,
106  limiter_type,
108  Threads::parallel_reduce(elem_info_range, limited_gradient_thread);
109  }
110  fe_problem.checkExceptionAndStopSolve();
111 
112  for (auto & vec : temporary_container)
113  vec->close();
114 
115  raw_container.swap(temporary_container);
116  }
117  }
118 }
The gradient in a volume using Green Gauss theorem and a cell-centered finite-volume approximation ca...
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & temporaryLinearFVLimitedGradientContainer(const Moose::FV::GradientLimiterType limiter_type)
Return temporary storage for limited gradients during gradient assembly.
SystemBase & _sys
Reference to the system object.
The gradient in a volume using Green Gauss theorem and a cell-centered finite-volume approximation ca...
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & rawLinearFVLimitedGradientContainer(const Moose::FV::GradientLimiterType limiter_type)
Access the persisted limited-gradient storage for a specific limiter.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & temporaryLinearFVGradientContainer()
Return temporary storage for gradients during gradient assembly.
void parallel_reduce(const Range &range, Body &body, const Partitioner &, unsigned int n_threads=libMesh::n_threads())
Compute limited cell gradients for linear FV variables.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
Persisted raw cell-centered gradient components keyed by spatial direction.
Scope guard for starting and stopping timing for a node.
Definition: PerfGuard.h:25
FEProblemBase & feProblem()
Definition: SystemBase.h:104
Interface for objects interacting with the PerfGraph.
const std::unordered_set< unsigned int > & requestedLinearFVLimitedGradientVariables(const Moose::FV::GradientLimiterType limiter_type) const
Access the variable numbers that requested limited gradients for a specific limiter.
const std::unordered_set< Moose::FV::GradientLimiterType > & requestedLinearFVLimitedGradientTypes() const
Access the limiter types requested for this system.
auto index_range(const T &sizable)

◆ computeGradients() [2/2]

void LinearFVGradientInterface::computeGradients

Compute and store raw and requested limited Green-Gauss gradients for linear FV variables.

Definition at line 27 of file LinearFVGradientInterface.C.

Referenced by FEProblemSolve::solve().

28 {
29  // No gradients have been requested, by now we should have set up the
30  // containers to receive the gradients. Time to early return.
31  if (_raw_grad_container.empty())
32  return;
33 
34  auto & temporary_gradient = temporaryLinearFVGradientContainer();
35  mooseAssert(temporary_gradient.size() == _raw_grad_container.size(),
36  "Temporary and raw gradient containers must have the same size.");
37  for (auto & vec : temporary_gradient)
38  vec->zero();
39 
40  auto & fe_problem = _sys.feProblem();
41  auto * const perf_graph_interface = dynamic_cast<PerfGraphInterface *>(&_sys);
42  mooseAssert(perf_graph_interface,
43  "LinearFVGradientInterface requires its owning system to implement "
44  "PerfGraphInterface.");
45  const auto perf_id = perf_graph_interface->registerTimedSection("LinearVariableFV_Gradients", 3);
46  mooseAssert(!Threads::in_threads, "PerfGraph timing cannot be used within threaded sections");
47  PerfGuard time_guard(perf_graph_interface->perfGraph(), perf_id);
48 
49  PARALLEL_TRY
50  {
52  FaceInfoRange face_info_range(fe_problem.mesh().ownedFaceInfoBegin(),
53  fe_problem.mesh().ownedFaceInfoEnd());
54 
56  fe_problem, _sys, temporary_gradient);
57  Threads::parallel_reduce(face_info_range, gradient_face_thread);
58  }
59  fe_problem.checkExceptionAndStopSolve();
60 
61  for (auto & vec : temporary_gradient)
62  vec->close();
63 
64  PARALLEL_TRY
65  {
67  ElemInfoRange elem_info_range(fe_problem.mesh().ownedElemInfoBegin(),
68  fe_problem.mesh().ownedElemInfoEnd());
69 
70  ComputeLinearFVGreenGaussGradientVolumeThread gradient_volume_thread(
71  fe_problem, _sys, temporary_gradient);
72  Threads::parallel_reduce(elem_info_range, gradient_volume_thread);
73  }
74  fe_problem.checkExceptionAndStopSolve();
75 
76  for (const auto i : index_range(_raw_grad_container))
77  temporary_gradient[i]->close();
78 
79  _raw_grad_container.swap(temporary_gradient);
80 
82  {
84  ElemInfoRange elem_info_range(fe_problem.mesh().ownedElemInfoBegin(),
85  fe_problem.mesh().ownedElemInfoEnd());
86 
87  for (const auto limiter_type : requestedLinearFVLimitedGradientTypes())
88  {
89  if (limiter_type == Moose::FV::GradientLimiterType::None)
90  continue;
91 
92  auto & raw_container = rawLinearFVLimitedGradientContainer(limiter_type);
93  auto & temporary_container = temporaryLinearFVLimitedGradientContainer(limiter_type);
94  mooseAssert(temporary_container.size() == raw_container.size(),
95  "Temporary and raw limited gradient containers must have the same size.");
96  for (auto & vec : temporary_container)
97  vec->zero();
98 
99  PARALLEL_TRY
100  {
101  ComputeLinearFVLimitedGradientThread limited_gradient_thread(
102  fe_problem,
103  _sys,
105  temporary_container,
106  limiter_type,
108  Threads::parallel_reduce(elem_info_range, limited_gradient_thread);
109  }
110  fe_problem.checkExceptionAndStopSolve();
111 
112  for (auto & vec : temporary_container)
113  vec->close();
114 
115  raw_container.swap(temporary_container);
116  }
117  }
118 }
The gradient in a volume using Green Gauss theorem and a cell-centered finite-volume approximation ca...
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & temporaryLinearFVLimitedGradientContainer(const Moose::FV::GradientLimiterType limiter_type)
Return temporary storage for limited gradients during gradient assembly.
The gradient in a volume using Green Gauss theorem and a cell-centered finite-volume approximation ca...
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & rawLinearFVLimitedGradientContainer(const Moose::FV::GradientLimiterType limiter_type)
Access the persisted limited-gradient storage for a specific limiter.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & temporaryLinearFVGradientContainer()
Return temporary storage for gradients during gradient assembly.
void parallel_reduce(const Range &range, Body &body, const Partitioner &, unsigned int n_threads=libMesh::n_threads())
Compute limited cell gradients for linear FV variables.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
Persisted raw cell-centered gradient components keyed by spatial direction.
System & _sys
Base class reference to the libmesh system.
Definition: LinearSystem.h:155
Scope guard for starting and stopping timing for a node.
Definition: PerfGuard.h:25
Interface for objects interacting with the PerfGraph.
const std::unordered_set< unsigned int > & requestedLinearFVLimitedGradientVariables(const Moose::FV::GradientLimiterType limiter_type) const
Access the variable numbers that requested limited gradients for a specific limiter.
const std::unordered_set< Moose::FV::GradientLimiterType > & requestedLinearFVLimitedGradientTypes() const
Access the limiter types requested for this system.
auto index_range(const T &sizable)

◆ computeLinearSystemInternal()

void LinearSystem::computeLinearSystemInternal ( const std::set< TagID > &  vector_tags,
const std::set< TagID > &  matrix_tags,
const bool  compute_gradients = true 
)
protected

Compute the right hand side and system matrix for given tags.

Parameters
vector_tagsThe tags of kernels for which the right hand side is to be computed.
matrix_tagsThe tags of kernels for which the system matrix is to be computed.
compute_gradientsA flag to disable the computation of new gradients during the assembly, can be used to lag gradients

Definition at line 190 of file LinearSystem.C.

Referenced by computeLinearSystemTags().

193 {
194  TIME_SECTION("computeLinearSystemInternal", 3);
195 
196  // Before we assemble we clear up the matrix and the vector
199 
200  // Make matrix ready to use
202 
203  for (auto tag : matrix_tags)
204  {
205  auto & matrix = getMatrix(tag);
206  // Necessary for speed
207  if (auto petsc_matrix = dynamic_cast<PetscMatrix<Number> *>(&matrix))
208  {
209  LibmeshPetscCall(MatSetOption(petsc_matrix->mat(),
210  MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1
211  PETSC_TRUE));
213  LibmeshPetscCall(
214  MatSetOption(petsc_matrix->mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE));
215  }
216  }
217 
218  if (compute_gradients)
220 
221  // linear contributions from the domain
222  PARALLEL_TRY
223  {
224  TIME_SECTION("LinearFVKernels_FullSystem", 3 /*, "Computing LinearFVKernels"*/);
225 
227  ElemInfoRange elem_info_range(_fe_problem.mesh().ownedElemInfoBegin(),
229 
231  FaceInfoRange face_info_range(_fe_problem.mesh().ownedFaceInfoBegin(),
233 
234  ComputeLinearFVElementalThread elem_thread(
235  _fe_problem, this->number(), vector_tags, matrix_tags);
236  Threads::parallel_reduce(elem_info_range, elem_thread);
237 
239  this->number(),
241  vector_tags,
242  matrix_tags);
243  Threads::parallel_reduce(face_info_range, face_thread);
244  }
245  PARALLEL_CATCH;
246 
247  closeTaggedMatrices(matrix_tags);
248 
251 
252  // Accumulate the occurrence of solution invalid warnings for the current iteration cumulative
253  // counters
256 }
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
Definition: MooseMesh.C:1559
void accumulateIterationIntoTimeStepOccurences()
Pass the number of solution invalid occurrences from current iteration to cumulative counters...
void parallel_reduce(const Range &range, Body &body, const Partitioner &, unsigned int n_threads=libMesh::n_threads())
NumericVector< Number > * rhs
virtual void zero()=0
elem_info_iterator ownedElemInfoBegin()
Iterators to owned faceInfo objects.
Definition: MooseMesh.C:1577
Adds contributions from volumetric terms discretized using the finite volume method to the matrix and...
virtual void activateAllMatrixTags()
Make all existing matrices active.
Definition: SystemBase.C:1132
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.
libMesh::LinearImplicitSystem & _linear_implicit_system
Base class reference to the linear implicit system in libmesh.
Definition: LinearSystem.h:200
virtual void zero()=0
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:183
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
virtual void close()=0
MooseApp & _app
Definition: SystemBase.h:988
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
virtual void close()=0
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:1025
SparseMatrix< Number > * matrix
virtual MooseMesh & mesh() override
Adds contributions from face terms discretized using the finite volume method to the matrix and right...
elem_info_iterator ownedElemInfoEnd()
Definition: MooseMesh.C:1585
face_info_iterator ownedFaceInfoEnd()
Definition: MooseMesh.C:1568
void computeGradients()
Compute and store raw and requested limited Green-Gauss gradients for linear FV variables.

◆ computeLinearSystemTags()

void LinearSystem::computeLinearSystemTags ( const std::set< TagID > &  vector_tags,
const std::set< TagID > &  matrix_tags,
const bool  compute_gradients = true 
)

Compute the right hand side and the system matrix of the system for given tags.

Parameters
vector_tagsThe IDs of the vector tags whose right hand side contribution should be included
matrix_tagsThe IDs of the matrix tags whose matrix contribution should be included
compute_gradientsA flag to disable the computation of new gradients during the assembly, can be used to lag gradients

Definition at line 164 of file LinearSystem.C.

Referenced by FEProblemBase::computeLinearSystemTags().

167 {
168  parallel_object_only();
169 
170  TIME_SECTION("LinearSystem::computeLinearSystemTags", 5);
171 
173 
175 
176  try
177  {
178  computeLinearSystemInternal(vector_tags, matrix_tags, compute_gradients);
179  }
180  catch (MooseException & e)
181  {
182  _console << "Exception detected " << e.what() << std::endl;
183  // The buck stops here, we have already handled the exception by
184  // calling stopSolve(), it is now up to PETSc to return a
185  // "diverged" reason during the next solve.
186  }
187 }
virtual const char * what() const
Get out the error message.
void computeLinearSystemInternal(const std::set< TagID > &vector_tags, const std::set< TagID > &matrix_tags, const bool compute_gradients=true)
Compute the right hand side and system matrix for given tags.
Definition: LinearSystem.C:190
Scope guard for starting and stopping Floating Point Exception Trapping.
virtual const std::string & name() const
Definition: SystemBase.C:1342
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.
void setCurrentLinearSystem(unsigned int sys_num)
Set the current linear system pointer.
unsigned int linearSysNum(const LinearSystemName &linear_sys_name) const override
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.

◆ computeVariables()

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

Definition at line 872 of file SystemBase.h.

872 {}

◆ 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(), VectorKernel::computeJacobian(), Kernel::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

◆ containsTimeKernel()

bool LinearSystem::containsTimeKernel ( )
overridevirtual

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

Considering that we don't have transient capabilities for linear systems at the moment, this is false.

Implements SolverSystem.

Definition at line 315 of file LinearSystem.C.

316 {
317  // Right now, FV kernels are in TheWarehouse so we have to use that.
318  std::vector<LinearFVKernel *> kernels;
319  auto base_query = _fe_problem.theWarehouse()
320  .query()
321  .template condition<AttribSysNum>(this->number())
322  .template condition<AttribSystem>("LinearFVKernel")
323  .queryInto(kernels);
324 
325  bool contains_time_kernel = false;
326  for (const auto kernel : kernels)
327  {
328  contains_time_kernel = dynamic_cast<LinearFVTimeDerivative *>(kernel);
329  if (contains_time_kernel)
330  break;
331  }
332 
333  return contains_time_kernel;
334 }
std::vector< T * > & queryInto(std::vector< T *> &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
Definition: TheWarehouse.h:311
TheWarehouse & theWarehouse() const
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1158
Kernel that adds contributions from a time derivative term to a linear system populated using the fin...
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466

◆ converged()

virtual bool LinearSystem::converged ( )
inlineoverridevirtual

At the moment, this is only used for the multi-system fixed point iteration.

We return true here since ther is no way to specify separate linear residuals in FEProblemSolve yet.

Implements SolverSystem.

Reimplemented in DumpObjectsLinearSystem.

Definition at line 54 of file LinearSystem.h.

54 { return _converged; }
bool _converged
If the solve on the linear system converged.
Definition: LinearSystem.h:197

◆ 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 SystemBase::customSetup ( const ExecFlagType exec_type)
virtualinherited

Reimplemented in NonlinearSystemBase, and AuxiliarySystem.

Definition at line 1574 of file SystemBase.C.

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

1575 {
1576  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1577  _vars[tid].customSetup(exec_type);
1578 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
virtual void customSetup(const ExecFlagType &exec_type)
Definition: SystemBase.C:1574
unsigned int THREAD_ID
Definition: MooseTypes.h:237

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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(), 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

◆ 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

◆ getRightHandSideNonTimeVector()

NumericVector< Number > & LinearSystem::getRightHandSideNonTimeVector ( )

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

Definition at line 265 of file LinearSystem.C.

Referenced by LinearSystem().

266 {
267  return *_rhs_non_time;
268 }
NumericVector< Number > * _rhs_non_time
right hand side vector for non-time contributions
Definition: LinearSystem.h:176

◆ getRightHandSideTimeVector()

NumericVector< Number > & LinearSystem::getRightHandSideTimeVector ( )

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

Definition at line 259 of file LinearSystem.C.

260 {
261  return *_rhs_time;
262 }
NumericVector< Number > * _rhs_time
right hand side vector for time contributions
Definition: LinearSystem.h:170

◆ getRightHandSideVector() [1/2]

NumericVector<Number>& LinearSystem::getRightHandSideVector ( )
inline

Fetching the right hand side vector from the libmesh system.

Definition at line 126 of file LinearSystem.h.

Referenced by FEProblemBase::computeLinearSystemSys().

126 { return *_linear_implicit_system.rhs; }
NumericVector< Number > * rhs
libMesh::LinearImplicitSystem & _linear_implicit_system
Base class reference to the linear implicit system in libmesh.
Definition: LinearSystem.h:200

◆ getRightHandSideVector() [2/2]

const NumericVector<Number>& LinearSystem::getRightHandSideVector ( ) const
inline

Definition at line 127 of file LinearSystem.h.

128  {
130  }
NumericVector< Number > * rhs
libMesh::LinearImplicitSystem & _linear_implicit_system
Base class reference to the linear implicit system in libmesh.
Definition: LinearSystem.h:200

◆ 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(), Kernel::computeOffDiagJacobianScalar(), ArrayIntegratedBC::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

◆ 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

◆ getSystemMatrix() [1/2]

SparseMatrix<Number>& LinearSystem::getSystemMatrix ( )
inline

Fetching the system matrix from the libmesh system.

Definition at line 133 of file LinearSystem.h.

Referenced by FEProblemBase::computeLinearSystemSys().

133 { return *_linear_implicit_system.matrix; }
libMesh::LinearImplicitSystem & _linear_implicit_system
Base class reference to the linear implicit system in libmesh.
Definition: LinearSystem.h:200
SparseMatrix< Number > * matrix

◆ getSystemMatrix() [2/2]

const SparseMatrix<Number>& LinearSystem::getSystemMatrix ( ) const
inline

Definition at line 134 of file LinearSystem.h.

134 { return *_linear_implicit_system.matrix; }
libMesh::LinearImplicitSystem & _linear_implicit_system
Base class reference to the linear implicit system in libmesh.
Definition: LinearSystem.h:200
SparseMatrix< Number > * matrix

◆ 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(), 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

◆ 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

◆ 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

◆ 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

◆ initializeContainer()

void LinearFVGradientInterface::initializeContainer ( std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number >>> &  container) const
protectedinherited

Definition at line 131 of file LinearFVGradientInterface.C.

133 {
134  container.clear();
135  mooseAssert(_sys.currentSolution(),
136  "Current solution must exist before building FV gradient storage.");
137  for (unsigned int i = 0; i < _sys.mesh().dimension(); ++i)
138  container.push_back(_sys.currentSolution()->zero_clone());
139 }
MooseMesh & mesh()
Definition: SystemBase.h:100
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
SystemBase & _sys
Reference to the system object.
virtual std::unique_ptr< NumericVector< T > > zero_clone() const=0
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
Definition: MooseMesh.C:3044

◆ 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 {}

◆ initialSetup()

void LinearSystem::initialSetup ( )
overridevirtual

Setup Functions.

Reimplemented from SystemBase.

Definition at line 107 of file LinearSystem.C.

108 {
111  // Checking if somebody accidentally assigned nonlinear variables to this system
112  const auto & var_names = _vars[0].names();
113  for (const auto & name : var_names)
114  if (!dynamic_cast<MooseLinearVariableFVReal *>(_vars[0].getVariable(name)))
115  mooseError("You are trying to add a nonlinear variable to a linear system! The variable "
116  "which is assigned to the wrong system: ",
117  name);
118 
120 
121  // Calling initial setup for the linear kernels
122  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
123  {
124  std::vector<LinearFVElementalKernel *> fv_elemental_kernels;
126  .query()
127  .template condition<AttribSystem>("LinearFVElementalKernel")
128  .template condition<AttribThread>(tid)
129  .queryInto(fv_elemental_kernels);
130 
131  for (auto * fv_kernel : fv_elemental_kernels)
132  fv_kernel->initialSetup();
133 
134  std::vector<LinearFVFluxKernel *> fv_flux_kernels;
136  .query()
137  .template condition<AttribSystem>("LinearFVFluxKernel")
138  .template condition<AttribThread>(tid)
139  .queryInto(fv_flux_kernels);
140 
141  for (auto * fv_kernel : fv_flux_kernels)
142  fv_kernel->initialSetup();
143 
144  std::vector<LinearFVBoundaryCondition *> fv_bcs;
146  .query()
147  .template condition<AttribSystem>("LinearFVBoundaryCondition")
148  .template condition<AttribThread>(tid)
149  .queryInto(fv_bcs);
150 
151  for (auto * fv_bc : fv_bcs)
152  fv_bc->initialSetup();
153  }
154 }
void rebuildLinearFVGradientStorage()
Rebuild persistent raw and temporary gradient storage after mesh/DOF changes.
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
std::vector< T * > & queryInto(std::vector< T *> &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
Definition: TheWarehouse.h:311
virtual const std::string & name() const
Definition: SystemBase.C:1342
TheWarehouse & theWarehouse() const
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
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
std::unique_ptr< NumericVector< Number > > current_local_solution
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 void initialSetup()
Setup Functions.
Definition: SystemBase.C:1560
virtual System & system() override
Get the reference to the libMesh system.
Definition: LinearSystem.h:114
unsigned int THREAD_ID
Definition: MooseTypes.h:237

◆ 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

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

virtual void LinearSystem::jacobianSetup ( )
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 62 of file LinearSystem.h.

62 {}

◆ linearFVGradientContainer()

const std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number> > >& LinearFVGradientInterface::linearFVGradientContainer ( ) const
inlineinherited

Access the stored raw cell-centered gradient components.

Returns
Raw cell-centered gradient vectors keyed by spatial direction.

Definition at line 45 of file LinearFVGradientInterface.h.

46  {
47  return _raw_grad_container;
48  }
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
Persisted raw cell-centered gradient components keyed by spatial direction.

◆ linearFVLimitedGradientContainer() [1/2]

const std::vector< std::unique_ptr< NumericVector< Number > > > & LinearFVGradientInterface::linearFVLimitedGradientContainer ( const Moose::FV::GradientLimiterType  limiter_type) const
inherited

Access the stored raw or limited cell-centered gradient components.

Parameters
limiter_typeThe limiter type whose gradient container is being requested.
Returns
The requested raw or limited gradient vectors ordered by spatial direction.

Definition at line 198 of file LinearFVGradientInterface.C.

200 {
201  if (limiter_type == Moose::FV::GradientLimiterType::None)
202  return _raw_grad_container;
203 
204  const auto it = _raw_limited_grad_containers.find(limiter_type);
205  if (it == _raw_limited_grad_containers.end())
206  mooseError("Limited gradient container was requested but not initialized on system '",
207  _sys.name(),
208  "'.");
209 
210  return it->second;
211 }
SystemBase & _sys
Reference to the system object.
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::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
Persisted raw cell-centered gradient components keyed by spatial direction.
virtual const std::string & name() const
Definition: SystemBase.C:1342
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _raw_limited_grad_containers
Persisted limited gradient components keyed by limiter type.

◆ linearFVLimitedGradientContainer() [2/2]

const std::vector< std::unique_ptr< NumericVector< Number > > > & LinearFVGradientInterface::linearFVLimitedGradientContainer

Access the stored raw or limited cell-centered gradient components.

Parameters
limiter_typeThe limiter type whose gradient container is being requested.
Returns
The requested raw or limited gradient vectors ordered by spatial direction.

Definition at line 198 of file LinearFVGradientInterface.C.

200 {
201  if (limiter_type == Moose::FV::GradientLimiterType::None)
202  return _raw_grad_container;
203 
204  const auto it = _raw_limited_grad_containers.find(limiter_type);
205  if (it == _raw_limited_grad_containers.end())
206  mooseError("Limited gradient container was requested but not initialized on system '",
207  _sys.name(),
208  "'.");
209 
210  return it->second;
211 }
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::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
Persisted raw cell-centered gradient components keyed by spatial direction.
System & _sys
Base class reference to the libmesh system.
Definition: LinearSystem.h:155
const std::string & name() const
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _raw_limited_grad_containers
Persisted limited gradient components keyed by limiter type.

◆ linearImplicitSystem()

libMesh::LinearImplicitSystem& LinearSystem::linearImplicitSystem ( )
inline

Return a reference to the stored linear implicit system.

Definition at line 93 of file LinearSystem.h.

Referenced by FEProblemBase::computeResidualL2Norm(), and Moose::PetscSupport::petscSetDefaults().

93 { return _linear_implicit_system; }
libMesh::LinearImplicitSystem & _linear_implicit_system
Base class reference to the linear implicit system in libmesh.
Definition: LinearSystem.h:200

◆ matrixFromColoring()

virtual bool SolverSystem::matrixFromColoring ( ) const
inlineprotectedvirtualinherited

Whether a system matrix is formed from coloring.

This influences things like when to compute time derivatives

Reimplemented in NonlinearSystem.

Definition at line 117 of file SolverSystem.h.

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

117 { return false; }

◆ 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

◆ 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(), MooseEigenSystem::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(), computeLinearSystemTags(), DisplacedProblem::DisplacedProblem(), SystemBase::getMatrix(), NonlinearSystemBase::getSplit(), DisplacedSystem::getVector(), SystemBase::getVector(), SystemBase::hasVector(), initialSetup(), NonlinearEigenSystem::postAddResidualObject(), MooseStaticCondensationPreconditioner::prefix(), SystemBase::removeMatrix(), SystemBase::removeVector(), SystemBase::solutionState(), 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

◆ needsLinearFVGradientStorage()

bool LinearFVGradientInterface::needsLinearFVGradientStorage ( ) const
protectedinherited

Definition at line 121 of file LinearFVGradientInterface.C.

122 {
123  for (const auto * const field_var : _sys.variableWarehouse().fieldVariables())
124  if (field_var->needsGradientVectorStorage())
125  return true;
126 
127  return false;
128 }
SystemBase & _sys
Reference to the system object.
const VariableWarehouse & variableWarehouse(THREAD_ID tid=0) const
Definition: SystemBase.h:757
const std::vector< MooseVariableFieldBase * > & fieldVariables() const
Get the list of variables.

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

unsigned int LinearSystem::nLinearIterations ( ) const
inline

Return the number of linear iterations.

Definition at line 112 of file LinearSystem.h.

Referenced by IterationAdaptiveDT::acceptStep().

112 { return _n_linear_iters; }
unsigned int _n_linear_iters
Number of linear iterations.
Definition: LinearSystem.h:188

◆ nonTimeVectorTag()

virtual TagID SystemBase::nonTimeVectorTag ( ) const
inlinevirtualinherited

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 303 of file SystemBase.h.

Referenced by SystemBase::defaultVectorTags(), and DisplacedSystem::nonTimeVectorTag().

303 { mooseError("Not implemented yet"); }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ 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(), 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(), containsTimeKernel(), Coupleable::coupled(), FEProblemBase::currentLinearSysNum(), FEProblemBase::currentNlSysNum(), PseudoTimestep::currentResidualNorm(), ComputeResidualThread::determineObjectWarehouses(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), Moose::doDerivatives(), VariableResidual::execute(), GreaterThanLessThanPostprocessor::execute(), NodalNormalsCorner::execute(), NodalNormalsEvaluator::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

◆ 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:177

◆ postInit()

virtual void SystemBase::postInit ( )
inlinevirtualinherited

Reimplemented in NonlinearEigenSystem.

Definition at line 163 of file SystemBase.h.

Referenced by NonlinearEigenSystem::postInit().

163 {}

◆ 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 SolverSystem::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 SystemBase.

Reimplemented in NonlinearSystemBase.

Definition at line 32 of file SolverSystem.C.

Referenced by NonlinearSystemBase::preInit().

33 {
35 
37 
38  if (_serialized_solution.get())
39  _serialized_solution->init(system().n_dofs(), false, SERIAL);
40 }
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
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:120
virtual void preInit()
This is called prior to the libMesh system has been init&#39;d.
Definition: SystemBase.h:157
std::unique_ptr< NumericVector< Number > > current_local_solution

◆ 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

◆ 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

◆ rawLinearFVLimitedGradientContainer()

std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number> > >& LinearFVGradientInterface::rawLinearFVLimitedGradientContainer ( const Moose::FV::GradientLimiterType  limiter_type)
inlineprotectedinherited

Access the persisted limited-gradient storage for a specific limiter.

Parameters
limiter_typeThe limiter type whose persisted storage is being accessed.
Returns
The persisted limited-gradient vectors keyed by spatial direction.

Definition at line 117 of file LinearFVGradientInterface.h.

118  {
119  return _raw_limited_grad_containers[limiter_type];
120  }
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _raw_limited_grad_containers
Persisted limited gradient components keyed by limiter type.

◆ rebuildLinearFVGradientStorage()

void LinearFVGradientInterface::rebuildLinearFVGradientStorage ( )
protectedinherited

Rebuild persistent raw and temporary gradient storage after mesh/DOF changes.

Definition at line 142 of file LinearFVGradientInterface.C.

Referenced by AuxiliarySystem::AuxiliarySystem(), initialSetup(), AuxiliarySystem::reinit(), and reinit().

143 {
144  _raw_grad_container.clear();
145  _temporary_gradient.clear();
148 
150  return;
151 
154 
155  for (const auto limiter_type : _requested_limited_gradient_types)
156  {
157  if (limiter_type == Moose::FV::GradientLimiterType::None)
158  continue;
159 
162  }
163 }
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _temporary_gradient
Scratch storage for raw gradients assembled during the current compute pass.
std::unordered_set< Moose::FV::GradientLimiterType > _requested_limited_gradient_types
Set of requested limiter types for which limited gradients should be computed.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
Persisted raw cell-centered gradient components keyed by spatial direction.
void initializeContainer(std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number >>> &container) const
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _temporary_limited_gradient
Scratch storage for limited gradients assembled during the current compute pass.
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _raw_limited_grad_containers
Persisted limited gradient components keyed by limiter type.

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

void LinearSystem::reinit ( )
overridevirtual

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 from SystemBase.

Definition at line 157 of file LinearSystem.C.

158 {
161 }
void rebuildLinearFVGradientStorage()
Rebuild persistent raw and temporary gradient storage after mesh/DOF changes.
const NumericVector< Number > * _current_solution
solution vector from solver
Definition: SolverSystem.h:120
std::unique_ptr< NumericVector< Number > > current_local_solution
virtual System & system() override
Get the reference to the libMesh system.
Definition: LinearSystem.h:114

◆ 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

◆ 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

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

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

◆ 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

◆ requestedLinearFVLimitedGradientTypes()

const std::unordered_set<Moose::FV::GradientLimiterType>& LinearFVGradientInterface::requestedLinearFVLimitedGradientTypes ( ) const
inlineinherited

Access the limiter types requested for this system.

Returns
The set of limiter types whose limited gradients should be assembled. They are only assembled for the variable(s) for which they were requested not all of them

Definition at line 72 of file LinearFVGradientInterface.h.

73  {
75  }
std::unordered_set< Moose::FV::GradientLimiterType > _requested_limited_gradient_types
Set of requested limiter types for which limited gradients should be computed.

◆ requestedLinearFVLimitedGradientVariables()

const std::unordered_set<unsigned int>& LinearFVGradientInterface::requestedLinearFVLimitedGradientVariables ( const Moose::FV::GradientLimiterType  limiter_type) const
inlineprotectedinherited

Access the variable numbers that requested limited gradients for a specific limiter.

Parameters
limiter_typeThe limiter type whose request set is being accessed.
Returns
The set of variable numbers that requested the limiter.

Definition at line 128 of file LinearFVGradientInterface.h.

129  {
130  return libmesh_map_find(_requested_limited_gradient_variables, limiter_type);
131  }
std::unordered_map< Moose::FV::GradientLimiterType, std::unordered_set< unsigned int > > _requested_limited_gradient_variables
Variable numbers requesting limited gradients, keyed by limiter type.

◆ requestLinearFVLimitedGradients() [1/2]

void LinearFVGradientInterface::requestLinearFVLimitedGradients ( const Moose::FV::GradientLimiterType  limiter_type,
unsigned int  variable_number 
)
inherited

Request storage and assembly of limiter-specific cell gradients.

Parameters
limiter_typeThe limiter whose gradient storage should be made available.
variable_numberThe libMesh variable number requesting the limited gradients.

Definition at line 166 of file LinearFVGradientInterface.C.

168 {
169  if (limiter_type == Moose::FV::GradientLimiterType::None)
170  return;
171 
172  auto * const variable =
173  dynamic_cast<MooseVariableFieldBase *>(_sys.variableWarehouse().getVariable(variable_number));
174  if (!variable)
175  mooseError("Limited gradients were requested for variable number ",
176  variable_number,
177  " on system '",
178  _sys.name(),
179  "', but no field variable with that number exists on the system.");
180 
181  if (!variable->needsGradientVectorStorage())
182  mooseError("Limited gradients were requested for variable '",
183  variable->name(),
184  "' on system '",
185  _sys.name(),
186  "', but regular gradients were not requested for that variable.");
187 
188  _requested_limited_gradient_variables[limiter_type].insert(variable_number);
189 
190  if (_requested_limited_gradient_types.insert(limiter_type).second && !_raw_grad_container.empty())
191  {
194  }
195 }
MooseVariableBase * getVariable(const std::string &var_name) const
Get a variable from the warehouse.
SystemBase & _sys
Reference to the system object.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::unordered_set< Moose::FV::GradientLimiterType > _requested_limited_gradient_types
Set of requested limiter types for which limited gradients should be computed.
This class provides an interface for common operations on field variables of both FE and FV types wit...
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
Persisted raw cell-centered gradient components keyed by spatial direction.
std::unordered_map< Moose::FV::GradientLimiterType, std::unordered_set< unsigned int > > _requested_limited_gradient_variables
Variable numbers requesting limited gradients, keyed by limiter type.
virtual const std::string & name() const
Definition: SystemBase.C:1342
const VariableWarehouse & variableWarehouse(THREAD_ID tid=0) const
Definition: SystemBase.h:757
void initializeContainer(std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number >>> &container) const
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _temporary_limited_gradient
Scratch storage for limited gradients assembled during the current compute pass.
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _raw_limited_grad_containers
Persisted limited gradient components keyed by limiter type.

◆ requestLinearFVLimitedGradients() [2/2]

void LinearFVGradientInterface::requestLinearFVLimitedGradients

Request storage and assembly of limiter-specific cell gradients.

Parameters
limiter_typeThe limiter whose gradient storage should be made available.
variable_numberThe libMesh variable number requesting the limited gradients.

Definition at line 166 of file LinearFVGradientInterface.C.

168 {
169  if (limiter_type == Moose::FV::GradientLimiterType::None)
170  return;
171 
172  auto * const variable =
173  dynamic_cast<MooseVariableFieldBase *>(_sys.variableWarehouse().getVariable(variable_number));
174  if (!variable)
175  mooseError("Limited gradients were requested for variable number ",
176  variable_number,
177  " on system '",
178  _sys.name(),
179  "', but no field variable with that number exists on the system.");
180 
181  if (!variable->needsGradientVectorStorage())
182  mooseError("Limited gradients were requested for variable '",
183  variable->name(),
184  "' on system '",
185  _sys.name(),
186  "', but regular gradients were not requested for that variable.");
187 
188  _requested_limited_gradient_variables[limiter_type].insert(variable_number);
189 
190  if (_requested_limited_gradient_types.insert(limiter_type).second && !_raw_grad_container.empty())
191  {
194  }
195 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::unordered_set< Moose::FV::GradientLimiterType > _requested_limited_gradient_types
Set of requested limiter types for which limited gradients should be computed.
This class provides an interface for common operations on field variables of both FE and FV types wit...
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
Persisted raw cell-centered gradient components keyed by spatial direction.
std::unordered_map< Moose::FV::GradientLimiterType, std::unordered_set< unsigned int > > _requested_limited_gradient_variables
Variable numbers requesting limited gradients, keyed by limiter type.
System & _sys
Base class reference to the libmesh system.
Definition: LinearSystem.h:155
void initializeContainer(std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number >>> &container) const
const std::string & name() const
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _temporary_limited_gradient
Scratch storage for limited gradients assembled during the current compute pass.
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _raw_limited_grad_containers
Persisted limited gradient components keyed by limiter type.

◆ residualCopy()

virtual NumericVector<Number>& SystemBase::residualCopy ( )
inlinevirtualinherited

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 427 of file SystemBase.h.

Referenced by DisplacedSystem::residualCopy().

428  {
429  mooseError("This system does not support getting a copy of the residual");
430  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ residualGhosted()

virtual NumericVector<Number>& SystemBase::residualGhosted ( )
inlinevirtualinherited

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 431 of file SystemBase.h.

Referenced by DisplacedSystem::residualGhosted().

432  {
433  mooseError("This system does not support getting a ghosted copy of the residual");
434  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ residualSetup()

virtual void LinearSystem::residualSetup ( )
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 61 of file LinearSystem.h.

61 {}

◆ residualVectorTag()

virtual TagID SystemBase::residualVectorTag ( ) const
inlinevirtualinherited

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 308 of file SystemBase.h.

Referenced by SystemBase::defaultVectorTags(), and DisplacedSystem::residualVectorTag().

308 { mooseError("Not implemented yet"); }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ 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

◆ rightHandSideNonTimeVectorTag()

TagID LinearSystem::rightHandSideNonTimeVectorTag ( ) const
inline

Definition at line 120 of file LinearSystem.h.

120 { return _rhs_non_time_tag; }
TagID _rhs_non_time_tag
Tag for non-time contribution rhs.
Definition: LinearSystem.h:173

◆ rightHandSideTimeVectorTag()

TagID LinearSystem::rightHandSideTimeVectorTag ( ) const
inline

Accessors of important tag IDs

Definition at line 119 of file LinearSystem.h.

119 { return _rhs_time_tag; }
TagID _rhs_time_tag
Tag for time contribution rhs.
Definition: LinearSystem.h:167

◆ rightHandSideVectorTag()

TagID LinearSystem::rightHandSideVectorTag ( ) const
inline

Definition at line 121 of file LinearSystem.h.

Referenced by FEProblemBase::computeLinearSystemSys().

121 { return _rhs_tag; }
TagID _rhs_tag
Used for the right hand side vector from PETSc.
Definition: LinearSystem.h:179

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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:1291
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

◆ 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(), MooseEigenSystem::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(), MooseEigenSystem::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(), MooseEigenSystem::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 MooseEigenSystem::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 LinearSystem::solve ( )
overridevirtual

Solve the system (using libMesh magic)

Reimplemented from SystemBase.

Reimplemented in DumpObjectsLinearSystem.

Definition at line 279 of file LinearSystem.C.

Referenced by FEProblemBase::solveLinearSystem().

280 {
281  TIME_SECTION("LinearSystem::solve", 2, "Solving linear system");
282 
283  // Clear the iteration counters
284  _current_l_its = 0;
285 
286  system().solve();
287 
288  // store info about the solve
290 
291  auto & linear_solver =
292  libMesh::cast_ref<PetscLinearSolver<Real> &>(*_linear_implicit_system.get_linear_solver());
293  _initial_linear_residual = linear_solver.get_initial_residual();
295  _converged = linear_solver.get_converged_reason() > 0;
296 
297  _console << "System: " << this->name() << " Initial residual: " << _initial_linear_residual
298  << " Final residual: " << _final_linear_residual << " Num. of Iter. " << _n_linear_iters
299  << std::endl;
300 
301  // determine whether solution invalid occurs in the converged solution
303 }
unsigned int _n_linear_iters
Number of linear iterations.
Definition: LinearSystem.h:188
void checkInvalidSolution()
Definition: SolverSystem.C:165
virtual LinearSolver< Number > * get_linear_solver() const override
unsigned int _current_l_its
The linear iterations needed for convergence.
Definition: LinearSystem.h:158
Real _initial_linear_residual
The initial linear residual.
Definition: LinearSystem.h:191
virtual const std::string & name() const
Definition: SystemBase.C:1342
libMesh::LinearImplicitSystem & _linear_implicit_system
Base class reference to the linear implicit system in libmesh.
Definition: LinearSystem.h:200
unsigned int n_linear_iterations() const
Real _final_linear_residual
The final linear residual.
Definition: LinearSystem.h:194
virtual void solve()
bool _converged
If the solve on the linear system converged.
Definition: LinearSystem.h:197
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
virtual System & system() override
Get the reference to the libMesh system.
Definition: LinearSystem.h:114

◆ stopSolve()

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

Quit the current solve as soon as possible.

Implements SolverSystem.

Reimplemented in DumpObjectsLinearSystem.

Definition at line 306 of file LinearSystem.C.

Referenced by FEProblemBase::checkExceptionAndStopSolve().

308 {
309  // We close the containers in case the solve restarts from a failed iteration
310  closeTaggedVectors(vector_tags_to_close);
312 }
libMesh::LinearImplicitSystem & _linear_implicit_system
Base class reference to the linear implicit system in libmesh.
Definition: LinearSystem.h:200
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:668
virtual void close()=0
SparseMatrix< Number > * matrix

◆ subdomainSetup()

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

◆ system() [1/2]

virtual System& LinearSystem::system ( )
inlineoverridevirtual

Get the reference to the libMesh system.

Implements SystemBase.

Definition at line 114 of file LinearSystem.h.

Referenced by initialSetup(), reinit(), and solve().

114 { return _sys; }
System & _sys
Base class reference to the libmesh system.
Definition: LinearSystem.h:155

◆ system() [2/2]

virtual const System& LinearSystem::system ( ) const
inlineoverridevirtual

Implements SystemBase.

Definition at line 115 of file LinearSystem.h.

115 { return _sys; }
System & _sys
Base class reference to the libmesh system.
Definition: LinearSystem.h:155

◆ systemMatrixTag()

virtual TagID LinearSystem::systemMatrixTag ( ) const
inlineoverridevirtual

Return the Matrix Tag ID for System.

Reimplemented from SystemBase.

Definition at line 122 of file LinearSystem.h.

Referenced by FEProblemBase::computeLinearSystemSys().

122 { return _system_matrix_tag; }
TagID _system_matrix_tag
Tag for every contribution to system matrix.
Definition: LinearSystem.h:185

◆ temporaryLinearFVGradientContainer()

std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number> > >& LinearFVGradientInterface::temporaryLinearFVGradientContainer ( )
inlineprotectedinherited

Return temporary storage for gradients during gradient assembly.

The returned vectors are persistent scratch storage reused across calls and swapped with the final gradient container before gradient assembly returns.

Definition at line 94 of file LinearFVGradientInterface.h.

95  {
96  return _temporary_gradient;
97  }
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _temporary_gradient
Scratch storage for raw gradients assembled during the current compute pass.

◆ temporaryLinearFVLimitedGradientContainer()

std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number> > >& LinearFVGradientInterface::temporaryLinearFVLimitedGradientContainer ( const Moose::FV::GradientLimiterType  limiter_type)
inlineprotectedinherited

Return temporary storage for limited gradients during gradient assembly.

The returned vectors are persistent scratch storage reused across calls and swapped with the final limited-gradient container before gradient assembly returns.

Parameters
limiter_typeThe limiter type whose temporary storage is being accessed.

Definition at line 106 of file LinearFVGradientInterface.h.

107  {
108  return _temporary_limited_gradient[limiter_type];
109  }
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _temporary_limited_gradient
Scratch storage for limited gradients assembled during the current compute pass.

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

virtual std::vector<std::string> LinearSystem::timeKernelVariableNames ( )
inlineoverridevirtual

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

Implements SolverSystem.

Definition at line 76 of file LinearSystem.h.

76 { return {}; }

◆ timestepSetup()

void SystemBase::timestepSetup ( )
virtualinherited

Reimplemented in NonlinearSystemBase, and AuxiliarySystem.

Definition at line 1567 of file SystemBase.C.

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

1568 {
1569  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1570  _vars[tid].timestepSetup();
1571 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
unsigned int THREAD_ID
Definition: MooseTypes.h:237
virtual void timestepSetup()
Definition: SystemBase.C:1567

◆ timeVectorTag()

virtual TagID SystemBase::timeVectorTag ( ) const
inlinevirtualinherited

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 in NonlinearSystemBase, and DisplacedSystem.

Definition at line 293 of file SystemBase.h.

Referenced by SystemBase::defaultVectorTags(), and DisplacedSystem::timeVectorTag().

293 { mooseError("Not implemented yet"); }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311

◆ update()

void SystemBase::update ( )
inherited

◆ 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:1291
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

Member Data Documentation

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

◆ _app

MooseApp& SystemBase::_app
protectedinherited

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

◆ _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(), 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(), 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(), solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), 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().

◆ _converged

bool LinearSystem::_converged
protected

If the solve on the linear system converged.

Definition at line 197 of file LinearSystem.h.

Referenced by converged(), and solve().

◆ _current_l_its

unsigned int LinearSystem::_current_l_its
protected

The linear iterations needed for convergence.

Definition at line 158 of file LinearSystem.h.

Referenced by solve().

◆ _current_solution

const NumericVector<Number>* SolverSystem::_current_solution
protectedinherited

◆ _du_dot_du

std::vector<Real> SystemBase::_du_dot_du
protectedinherited

Derivative of time derivative of u with respect to uj.

This depends on the time integration scheme

Definition at line 1017 of file SystemBase.h.

Referenced by SystemBase::addVariable(), SystemBase::duDotDu(), and SystemBase::duDotDus().

◆ _du_dotdot_du

Real SystemBase::_du_dotdot_du
protectedinherited

Definition at line 1018 of file SystemBase.h.

Referenced by SystemBase::duDotDotDu().

◆ _factory

Factory& SystemBase::_factory
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(), compute(), NonlinearSystemBase::computeDamping(), NonlinearSystemBase::computeDiracContributions(), AuxiliarySystem::computeElementalVarsHelper(), NonlinearSystemBase::computeJacobian(), NonlinearSystemBase::computeJacobianBlocks(), NonlinearSystemBase::computeJacobianInternal(), computeLinearSystemInternal(), 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(), containsTimeKernel(), NonlinearSystem::converged(), NonlinearSystemBase::customSetup(), MooseEigenSystem::eigenKernelOnCurrent(), MooseEigenSystem::eigenKernelOnOld(), NonlinearSystemBase::enforceNodalConstraintsJacobian(), NonlinearSystemBase::enforceNodalConstraintsResidual(), SystemBase::feProblem(), NonlinearSystemBase::getResidualNonTimeVector(), NonlinearSystemBase::getResidualTimeVector(), initialSetup(), NonlinearSystemBase::initialSetup(), NonlinearSystemBase::jacobianSetup(), 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_linear_residual

Real LinearSystem::_final_linear_residual
protected

The final linear residual.

Definition at line 194 of file LinearSystem.h.

Referenced by solve().

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

◆ _initial_linear_residual

Real LinearSystem::_initial_linear_residual
protected

The initial linear residual.

Definition at line 191 of file LinearSystem.h.

Referenced by solve().

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

◆ _linear_implicit_system

libMesh::LinearImplicitSystem& LinearSystem::_linear_implicit_system
protected

Base class reference to the linear implicit system in libmesh.

Definition at line 200 of file LinearSystem.h.

Referenced by computeLinearSystemInternal(), getRightHandSideVector(), getSystemMatrix(), linearImplicitSystem(), LinearSystem(), solve(), and stopSolve().

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

◆ _matrix_tags

std::set<TagID> LinearSystem::_matrix_tags
protected

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

Definition at line 164 of file LinearSystem.h.

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

unsigned int LinearSystem::_n_linear_iters
protected

Number of linear iterations.

Definition at line 188 of file LinearSystem.h.

Referenced by nLinearIterations(), and solve().

◆ _name

std::string SystemBase::_name
protectedinherited

The name of this system.

Definition at line 993 of file SystemBase.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().

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

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

◆ _raw_grad_container

std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number> > > LinearFVGradientInterface::_raw_grad_container
protectedinherited

Persisted raw cell-centered gradient components keyed by spatial direction.

Definition at line 145 of file LinearFVGradientInterface.h.

Referenced by AuxiliarySystem::compute(), and LinearFVGradientInterface::linearFVGradientContainer().

◆ _raw_limited_grad_containers

std::unordered_map<Moose::FV::GradientLimiterType, std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number> > > > LinearFVGradientInterface::_raw_limited_grad_containers
protectedinherited

Persisted limited gradient components keyed by limiter type.

Definition at line 157 of file LinearFVGradientInterface.h.

Referenced by LinearFVGradientInterface::rawLinearFVLimitedGradientContainer().

◆ _requested_limited_gradient_types

std::unordered_set<Moose::FV::GradientLimiterType> LinearFVGradientInterface::_requested_limited_gradient_types
protectedinherited

Set of requested limiter types for which limited gradients should be computed.

Definition at line 148 of file LinearFVGradientInterface.h.

Referenced by LinearFVGradientInterface::requestedLinearFVLimitedGradientTypes().

◆ _requested_limited_gradient_variables

std::unordered_map<Moose::FV::GradientLimiterType, std::unordered_set<unsigned int> > LinearFVGradientInterface::_requested_limited_gradient_variables
protectedinherited

Variable numbers requesting limited gradients, keyed by limiter type.

Definition at line 152 of file LinearFVGradientInterface.h.

Referenced by LinearFVGradientInterface::requestedLinearFVLimitedGradientVariables().

◆ _rhs_non_time

NumericVector<Number>* LinearSystem::_rhs_non_time
protected

right hand side vector for non-time contributions

Definition at line 176 of file LinearSystem.h.

Referenced by getRightHandSideNonTimeVector().

◆ _rhs_non_time_tag

TagID LinearSystem::_rhs_non_time_tag
protected

Tag for non-time contribution rhs.

Definition at line 173 of file LinearSystem.h.

Referenced by rightHandSideNonTimeVectorTag().

◆ _rhs_tag

TagID LinearSystem::_rhs_tag
protected

Used for the right hand side vector from PETSc.

Definition at line 179 of file LinearSystem.h.

Referenced by LinearSystem(), and rightHandSideVectorTag().

◆ _rhs_time

NumericVector<Number>* LinearSystem::_rhs_time
protected

right hand side vector for time contributions

Definition at line 170 of file LinearSystem.h.

Referenced by getRightHandSideTimeVector().

◆ _rhs_time_tag

TagID LinearSystem::_rhs_time_tag
protected

Tag for time contribution rhs.

Definition at line 167 of file LinearSystem.h.

Referenced by rightHandSideTimeVectorTag().

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

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

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

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

Definition at line 204 of file LinearSystem.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().

◆ _subproblem

SubProblem& SystemBase::_subproblem
protectedinherited

◆ _sys

System& LinearSystem::_sys
protected

Base class reference to the libmesh system.

Definition at line 155 of file LinearSystem.h.

Referenced by system().

◆ _system_matrix_non_time_tag

TagID LinearSystem::_system_matrix_non_time_tag
protected

Tag for non-time contribution to the system matrix.

Definition at line 182 of file LinearSystem.h.

◆ _system_matrix_tag

TagID LinearSystem::_system_matrix_tag
protected

Tag for every contribution to system matrix.

Definition at line 185 of file LinearSystem.h.

Referenced by LinearSystem(), and systemMatrixTag().

◆ _tagged_matrices

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

◆ _tagged_vectors

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

◆ _temporary_gradient

std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number> > > LinearFVGradientInterface::_temporary_gradient
protectedinherited

Scratch storage for raw gradients assembled during the current compute pass.

Definition at line 142 of file LinearFVGradientInterface.h.

Referenced by LinearFVGradientInterface::temporaryLinearFVGradientContainer().

◆ _temporary_limited_gradient

std::unordered_map<Moose::FV::GradientLimiterType, std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number> > > > LinearFVGradientInterface::_temporary_limited_gradient
protectedinherited

Scratch storage for limited gradients assembled during the current compute pass.

Definition at line 162 of file LinearFVGradientInterface.h.

Referenced by LinearFVGradientInterface::temporaryLinearFVLimitedGradientContainer().

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

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

◆ _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(), 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

◆ _vector_tags

std::set<TagID> LinearSystem::_vector_tags
protected

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

Definition at line 161 of file LinearSystem.h.

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