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

Base class for a system (of equations) More...

#include <SystemBase.h>

Inheritance diagram for SystemBase:
[legend]

Public Member Functions

 SystemBase (SubProblem &subproblem, FEProblemBase &fe_problem, const std::string &name, Moose::VarKindType var_kind)
 
virtual ~SystemBase ()
 
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 libMesh::Systemsystem ()=0
 Get the reference to the libMesh system. More...
 
virtual const libMesh::Systemsystem () const =0
 
virtual void preInit ()
 This is called prior to the libMesh system has been init'd. More...
 
virtual void postInit ()
 
virtual void reinit ()
 Reinitialize the system when the degrees of freedom in this system have changed. More...
 
virtual void initializeObjects ()
 Called only once, just before the solve begins so objects can do some precalculations. More...
 
void update ()
 Update the system (doing libMesh magic) More...
 
virtual void solve ()
 Solve the system (using 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 ()
 
virtual void restoreSolutions ()
 Restore current solutions (call after your solve failed) More...
 
virtual const NumericVector< Number > *const & currentSolution () const =0
 The solution vector that is currently being operated on. More...
 
NumericVector< Number > & solution ()
 
NumericVector< Number > & solutionOld ()
 
NumericVector< Number > & solutionOlder ()
 
const NumericVector< Number > & solution () const
 
const NumericVector< Number > & solutionOld () const
 
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 NumberduDotDu (unsigned int var_num=0) const
 
virtual const NumberduDotDotDu () const
 
virtual NumericVector< Number > * solutionUDot ()
 
virtual NumericVector< Number > * solutionUDotDot ()
 
virtual NumericVector< Number > * solutionUDotOld ()
 
virtual NumericVector< Number > * solutionUDotDotOld ()
 
virtual const NumericVector< Number > * solutionUDot () const
 
virtual const NumericVector< Number > * solutionUDotDot () const
 
virtual const NumericVector< Number > * solutionUDotOld () const
 
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 systemMatrixTag () const
 Return the Matrix Tag ID for System. 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 augmentSparsity (libMesh::SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz)=0
 Will modify the sparsity pattern to add logical geometric connections. 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 >
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 >
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, unsigned int var_number)
 Returns a field variable pointer - this includes finite volume variables. More...
 
template<typename T >
MooseVariableFV< T > & getFVVariable (THREAD_ID tid, const std::string &var_name)
 Return a finite volume variable. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, const std::string &var_name) const
 Gets a reference to a scalar variable with specified number. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, unsigned int var_number) const
 Gets a reference to a variable with specified number. More...
 
virtual const std::set< SubdomainID > * getVariableBlocks (unsigned int var_number)
 Get the block where a variable of this system is defined. More...
 
virtual unsigned int nVariables () const
 Get the number of variables in this system. More...
 
unsigned int nFieldVariables () const
 Get the number of field variables in this system. More...
 
unsigned int nFVVariables () const
 Get the number of finite volume variables in this system. More...
 
std::size_t getMaxVarNDofsPerElem () const
 Gets the maximum number of dofs used by any one variable on any one element. More...
 
std::size_t getMaxVarNDofsPerNode () const
 Gets the maximum number of dofs used by any one variable on any one node. More...
 
void assignMaxVarNDofsPerElem (std::size_t max_dofs)
 assign the maximum element dofs More...
 
void assignMaxVarNDofsPerNode (std::size_t max_dofs)
 assign the maximum node dofs More...
 
virtual void addVariableToZeroOnResidual (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each residual evaluation. More...
 
virtual void addVariableToZeroOnJacobian (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each Jacobian evaluation. More...
 
virtual void zeroVariables (std::vector< std::string > &vars_to_be_zeroed)
 Zero out the solution for the list of variables passed in. More...
 
virtual void zeroVariablesForResidual ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on residual evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual void zeroVariablesForJacobian ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on Jacobian evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual libMesh::Order getMinQuadratureOrder ()
 Get minimal quadrature order needed for integrating variables in this system. More...
 
virtual void prepare (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareFace (THREAD_ID tid, bool resize_data)
 Prepare the system for use on sides. More...
 
virtual void prepareNeighbor (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareLowerD (THREAD_ID tid)
 Prepare the system for use for lower dimensional elements. More...
 
virtual void reinitElem (const Elem *elem, THREAD_ID tid)
 Reinit an element assembly info. More...
 
virtual void reinitElemFace (const Elem *elem, unsigned int side, THREAD_ID tid)
 Reinit assembly info for a side of an element. More...
 
virtual void reinitNeighborFace (const Elem *elem, unsigned int side, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitNeighbor (const Elem *elem, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitLowerD (THREAD_ID tid)
 Compute the values of the variables on the lower dimensional element. More...
 
virtual void reinitNode (const Node *node, THREAD_ID tid)
 Reinit nodal assembly info. More...
 
virtual void reinitNodeFace (const Node *node, BoundaryID bnd_id, THREAD_ID tid)
 Reinit nodal assembly info on a face. More...
 
virtual void reinitNodes (const std::vector< dof_id_type > &nodes, THREAD_ID tid)
 Reinit variables at a set of nodes. More...
 
virtual void reinitNodesNeighbor (const std::vector< dof_id_type > &nodes, THREAD_ID tid)
 Reinit variables at a set of neighbor nodes. More...
 
virtual void reinitScalars (THREAD_ID tid, bool reinit_for_derivative_reordering=false)
 Reinit scalar varaibles. More...
 
virtual void addVariableToCopy (const std::string &dest_name, const std::string &source_name, const std::string &timestep)
 Add info about variable that will be copied. More...
 
const std::vector< MooseVariableFieldBase * > & getVariables (THREAD_ID tid)
 
const std::vector< MooseVariableScalar * > & getScalarVariables (THREAD_ID tid)
 
const std::set< SubdomainID > & getSubdomainsForVar (unsigned int var_number) const
 
const std::set< SubdomainID > & getSubdomainsForVar (const std::string &var_name) const
 Get the block where a variable of this system is defined. More...
 
void removeVector (const std::string &name)
 Remove a vector from the system with the given name. More...
 
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 removeVector (TagID tag_id)
 Remove a solution length vector from the system with the specified TagID. 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 initialSetup ()
 Setup Functions. More...
 
virtual void timestepSetup ()
 
virtual void customSetup (const ExecFlagType &exec_type)
 
virtual void subdomainSetup ()
 
virtual void residualSetup ()
 
virtual void jacobianSetup ()
 
void clearAllDofIndices ()
 Clear all dof indices from moose variables. More...
 
void setActiveVariableCoupleableVectorTags (const std::set< TagID > &vtags, THREAD_ID tid)
 Set the active vector tags for the variables. More...
 
void setActiveScalarVariableCoupleableVectorTags (const std::set< TagID > &vtags, THREAD_ID tid)
 Set the active vector tags for the scalar variables. More...
 
Moose::VarKindType varKind () const
 
const std::vector< std::unique_ptr< NumericVector< Number > > > & gradientContainer () const
 Reference to the container vector which hold gradients at dofs (if it can be interpreted). More...
 
virtual void compute (ExecFlagType type)=0
 Compute time derivatives, auxiliary variables, etc. More...
 
void copyTimeIntegrators (const SystemBase &other_sys)
 Copy time integrators from another system. More...
 
const TimeIntegratorgetTimeIntegrator (const unsigned int var_num) const
 Retrieve the time integrator that integrates the given variable's equation. More...
 
const TimeIntegratorqueryTimeIntegrator (const unsigned int var_num) const
 Retrieve the time integrator that integrates the given variable's equation. More...
 
const std::vector< std::shared_ptr< TimeIntegrator > > & getTimeIntegrators ()
 
std::string prefix () const
 
void sizeVariableMatrixData ()
 size the matrix data for each variable for the number of matrix tags we have More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
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
 

Public Attributes

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

Protected Member Functions

virtual NumericVector< Number > & solutionInternal () const =0
 Internal getter for solution owned by libMesh. More...
 

Protected Attributes

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...
 
std::vector< std::unique_ptr< NumericVector< Number > > > _raw_grad_container
 A cache for storing gradients at dof locations. More...
 
const Parallel::Communicator_communicator
 

Private Member Functions

TagName oldSolutionStateVectorName (const unsigned int, Moose::SolutionIterationType iteration_type) const
 Gets the vector name used for an old (not current) solution state. More...
 

Private Attributes

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) More...
 
std::vector< NumericVector< Number > * > _saved_solution_states
 The saved solution states (0 = current, 1 = old, 2 = older, etc) More...
 

Detailed Description

Base class for a system (of equations)

Definition at line 84 of file SystemBase.h.

Constructor & Destructor Documentation

◆ SystemBase()

SystemBase::SystemBase ( SubProblem subproblem,
FEProblemBase fe_problem,
const std::string &  name,
Moose::VarKindType  var_kind 
)

Definition at line 57 of file SystemBase.C.

64  _fe_problem(fe_problem),
68  _name(name),
70  _var_map(),
71  _max_var_number(0),
72  _u_dot(nullptr),
73  _u_dotdot(nullptr),
74  _u_dot_old(nullptr),
75  _u_dotdot_old(nullptr),
76  _saved_old(nullptr),
77  _saved_older(nullptr),
78  _saved_dot_old(nullptr),
79  _saved_dotdot_old(nullptr),
80  _var_kind(var_kind),
83  _automatic_scaling(false),
84  _verbose(false),
86 {
87 }
virtual MooseMesh & mesh()=0
unsigned int n_threads()
bool _solution_states_initialized
Whether or not the solution states have been initialized.
Definition: SystemBase.h:1061
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
Definition: SystemBase.h:1011
size_t _max_var_n_dofs_per_node
Maximum number of dofs for any one variable on any one node.
Definition: SystemBase.h:1046
Factory & _factory
Definition: SystemBase.h:989
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot
Definition: SystemBase.h:1008
size_t _max_var_n_dofs_per_elem
Maximum number of dofs for any one variable on any one element.
Definition: SystemBase.h:1043
NumericVector< Real > * _saved_older
Definition: SystemBase.h:1031
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition: MooseBase.h:83
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
Definition: MooseApp.h:394
virtual const std::string & name() const
Definition: SystemBase.C:1332
bool _automatic_scaling
Whether to automatically scale the variables.
Definition: SystemBase.h:1055
SubProblem & subproblem()
Definition: SystemBase.h:101
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h:983
ConsoleStreamInterface(MooseApp &app)
A class for providing a helper stream object for writting message to all the Output objects...
Moose::VarKindType _var_kind
default kind of variables in this system
Definition: SystemBase.h:1038
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:1034
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:998
std::string _name
The name of this system.
Definition: SystemBase.h:993
MooseApp & _app
Definition: SystemBase.h:988
FEProblemBase & _fe_problem
the governing finite element/volume problem
Definition: SystemBase.h:986
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
bool _verbose
True if printing out additional information.
Definition: SystemBase.h:1058
MooseMesh & _mesh
Definition: SystemBase.h:991
NumericVector< Number > * _u_dot
solution vector for u^dot
Definition: SystemBase.h:1006
NumericVector< Real > * _saved_old
Definition: SystemBase.h:1030
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:1035
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:1000
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
Definition: SystemBase.h:1013

◆ ~SystemBase()

virtual SystemBase::~SystemBase ( )
inlinevirtual

Definition at line 92 of file SystemBase.h.

92 {}

Member Function Documentation

◆ activateAllMatrixTags()

void SystemBase::activateAllMatrixTags ( )
virtual

Make all existing matrices active.

Definition at line 1123 of file SystemBase.C.

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

1124 {
1125  auto num_matrix_tags = _subproblem.numMatrixTags();
1126 
1127  _matrix_tag_active_flags.resize(num_matrix_tags);
1128  _active_tagged_matrices.clear();
1129 
1130  for (const auto tag : make_range(num_matrix_tags))
1131  if (hasMatrix(tag))
1132  {
1133  _matrix_tag_active_flags[tag] = true;
1134  _active_tagged_matrices.emplace(tag, &getMatrix(tag));
1135  }
1136  else
1137  _matrix_tag_active_flags[tag] = false;
1138 }
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:360
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:1016
IntRange< T > make_range(T beg, T end)

◆ addDotVectors()

void SystemBase::addDotVectors ( )
virtual

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

Referenced by DisplacedSystem::addDotVectors().

1626 {
1627  if (_fe_problem.uDotRequested())
1628  _u_dot = &addVector("u_dot", true, GHOSTED);
1630  _u_dot_old = &addVector("u_dot_old", true, GHOSTED);
1632  _u_dotdot = &addVector("u_dotdot", true, GHOSTED);
1634  _u_dotdot_old = &addVector("u_dotdot_old", true, GHOSTED);
1635 }
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)

Adds a matrix with a given tag.

Parameters
tag_nameThe name of the tag

Definition at line 570 of file SystemBase.C.

571 {
572  if (!_subproblem.matrixTagExists(tag))
573  mooseError("Cannot add tagged matrix with TagID ",
574  tag,
575  " in system '",
576  name(),
577  "' because the tag does not exist in the problem");
578 
579  if (hasMatrix(tag))
580  return getMatrix(tag);
581 
582  const auto matrix_name = _subproblem.matrixTagName(tag);
583  SparseMatrix<Number> & mat = system().add_matrix(matrix_name);
584  associateMatrixToTag(mat, tag);
585 
586  return mat;
587 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
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:360
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
Definition: SystemBase.C:1068
virtual const std::string & name() const
Definition: SystemBase.C:1332
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:1016
SparseMatrix< Number > & add_matrix(std::string_view mat_name, ParallelType type=PARALLEL, MatrixBuildType mat_build_type=MatrixBuildType::AUTOMATIC)
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:357

◆ addScalingVector()

void SystemBase::addScalingVector ( )

Add the scaling factor vector to the system.

Definition at line 1537 of file SystemBase.C.

Referenced by MooseVariableBase::initialSetup().

1538 {
1539  addVector("scaling_factors", /*project=*/false, libMesh::ParallelType::GHOSTED);
1541 }
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:1170
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:1149

◆ addTimeIntegrator()

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

Definition at line 1650 of file SystemBase.C.

1653 {
1654  parameters.set<SystemBase *>("_sys") = this;
1655  _time_integrators.push_back(_factory.create<TimeIntegrator>(type, name, parameters));
1656 }
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:84
virtual const std::string & name() const
Definition: SystemBase.C:1332
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 
)
virtual

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

Referenced by AuxiliarySystem::addVariable().

721 {
723 
724  const auto components = parameters.get<unsigned int>("components");
725 
726  // Convert the std::vector parameter provided by the user into a std::set for use by libMesh's
727  // System::add_variable method
728  std::set<SubdomainID> blocks;
729  const auto & block_param = parameters.get<std::vector<SubdomainName>>("block");
730  for (const auto & subdomain_name : block_param)
731  {
732  SubdomainID blk_id = _mesh.getSubdomainID(subdomain_name);
733  blocks.insert(blk_id);
734  }
735 
736  const auto fe_type =
737  FEType(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")),
738  Utility::string_to_enum<FEFamily>(parameters.get<MooseEnum>("family")));
739  const auto fe_field_type = FEInterface::field_type(fe_type);
740 
741  unsigned int var_num;
742 
743  if (var_type == "ArrayMooseVariable")
744  {
745  if (fe_field_type == TYPE_VECTOR)
746  mooseError("Vector family type cannot be used in an array variable");
747 
748  std::vector<std::string> array_var_component_names;
749  const bool has_array_names = parameters.isParamValid("array_var_component_names");
750  if (has_array_names)
751  {
752  array_var_component_names =
753  parameters.get<std::vector<std::string>>("array_var_component_names");
754  if (array_var_component_names.size() != components)
755  parameters.paramError("array_var_component_names",
756  "Must be the same size as 'components' (size ",
757  components,
758  ") for array variable '",
759  name,
760  "'");
761  }
762 
763  // Build up the variable names
764  std::vector<std::string> var_names;
765  for (unsigned int i = 0; i < components; i++)
766  {
767  if (!has_array_names)
768  array_var_component_names.push_back(std::to_string(i));
769  var_names.push_back(name + "_" + array_var_component_names[i]);
770  }
771 
772  // makes sure there is always a name, either the provided one or '1 2 3 ...'
773  parameters.set<std::vector<std::string>>("array_var_component_names") =
774  array_var_component_names;
775 
776  // The number returned by libMesh is the _last_ variable number... we want to hold onto the
777  // _first_
778  var_num = system().add_variables(var_names, fe_type, &blocks) - (components - 1);
779 
780  // Set as array variable
781  if (parameters.isParamSetByUser("array") && !parameters.get<bool>("array"))
782  parameters.paramError("array",
783  "Must be set to true for variable '",
784  name,
785  "' because 'components' > 1 (is an array variable)");
786  parameters.set<bool>("array") = true;
787  }
788  else
789  {
790  if (parameters.isParamSetByUser("array_var_component_names"))
791  parameters.paramError("array_var_component_names",
792  "Should not be set because this variable (",
793  name,
794  ") is a non-array variable");
795  var_num = system().add_variable(name, fe_type, &blocks);
796  }
797 
798  parameters.set<unsigned int>("_var_num") = var_num;
799  parameters.set<SystemBase *>("_system_base") = this;
800 
801  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
802  {
803  parameters.set<THREAD_ID>("tid") = tid;
804  std::shared_ptr<MooseVariableBase> var =
805  _factory.create<MooseVariableBase>(var_type, name, parameters, tid);
806 
807  _vars[tid].add(name, var);
808 
809  if (auto fe_var = dynamic_cast<MooseVariableFieldBase *>(var.get()))
810  {
811  auto required_size = var_num + components;
812  if (required_size > _numbered_vars[tid].size())
813  _numbered_vars[tid].resize(required_size);
814  for (MooseIndex(components) component = 0; component < components; ++component)
815  _numbered_vars[tid][var_num + component] = fe_var;
816 
817  if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADReal> *>(fe_var))
818  _subproblem.addFunctor(name, *functor, tid);
819  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<ADRealVectorValue> *>(fe_var))
820  _subproblem.addFunctor(name, *functor, tid);
821  else if (auto * const functor = dynamic_cast<Moose::FunctorBase<RealEigenVector> *>(fe_var))
822  _subproblem.addFunctor(name, *functor, tid);
823  else
824  mooseError("This should be a functor");
825  }
826 
827  if (var->blockRestricted())
828  for (const SubdomainID & id : var->blockIDs())
829  for (MooseIndex(components) component = 0; component < components; ++component)
830  _var_map[var_num + component].insert(id);
831  else
832  for (MooseIndex(components) component = 0; component < components; ++component)
833  _var_map[var_num + component] = std::set<SubdomainID>();
834  }
835 
836  // getMaxVariableNumber is an API method used in Rattlesnake
837  if (var_num > _max_var_number)
838  _max_var_number = var_num;
839  _du_dot_du.resize(var_num + 1);
840 }
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
std::vector< std::vector< MooseVariableFieldBase * > > _numbered_vars
Map variable number to its pointer.
Definition: SystemBase.h: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:333
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
void addFunctor(const std::string &name, const Moose::FunctorBase< T > &functor, const THREAD_ID tid)
add a functor to the problem functor container
Definition: SubProblem.h:1375
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
Factory & _factory
Definition: SystemBase.h:989
Base class for a system (of equations)
Definition: SystemBase.h:84
virtual const std::string & name() const
Definition: SystemBase.C:1332
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:33
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h: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:209
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
Definition: MooseMesh.C:1731
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 
)
virtual

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

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

1170 {
1171  _var_to_copy.push_back(VarCopyInfo(dest_name, source_name, timestep));
1172 }
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:1040
Information about variables that will be copied.
Definition: SystemBase.h:66

◆ addVariableToZeroOnJacobian()

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

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 180 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().

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

◆ addVariableToZeroOnResidual()

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

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 174 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().

175 {
176  _vars_to_be_zeroed_on_residual.push_back(var_name);
177 }
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 
)

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 addDotVectors(), addScalingVector(), NonlinearTimeIntegratorInterface::addVector(), SecantSolve::allocateStorage(), SteffensenSolve::allocateStorage(), PicardSolve::allocateStorage(), NonlinearSystemBase::getResidualNonTimeVector(), NonlinearSystemBase::getResidualTimeVector(), CentralDifference::initialSetup(), needSolutionState(), NonlinearSystemBase::residualGhosted(), and saveOldSolutions().

◆ addVector() [2/2]

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

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

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

◆ applyScalingFactors()

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

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

Referenced by NonlinearSystemBase::computeScaling().

1488 {
1489  for (MooseIndex(_vars) thread = 0; thread < _vars.size(); ++thread)
1490  {
1491  auto & field_variables = _vars[thread].fieldVariables();
1492  for (MooseIndex(field_variables) i = 0, p = 0; i < field_variables.size(); ++i)
1493  {
1494  auto factors = field_variables[i]->arrayScalingFactor();
1495  for (unsigned int j = 0; j < field_variables[i]->count(); ++j, ++p)
1496  factors[j] /= inverse_scaling_factors[p];
1497 
1498  field_variables[i]->scalingFactor(factors);
1499  }
1500 
1501  auto offset = field_variables.size();
1502 
1503  auto & scalar_variables = _vars[thread].scalars();
1504  for (MooseIndex(scalar_variables) i = 0; i < scalar_variables.size(); ++i)
1505  scalar_variables[i]->scalingFactor(
1506  {1. / inverse_scaling_factors[offset + i] * scalar_variables[i]->scalingFactor()});
1507 
1508  if (thread == 0 && _verbose)
1509  {
1510  _console << "Automatic scaling factors:\n";
1511  auto original_flags = _console.flags();
1512  auto original_precision = _console.precision();
1513  _console.unsetf(std::ios_base::floatfield);
1514  _console.precision(6);
1515 
1516  for (const auto & field_variable : field_variables)
1517  {
1518  const auto & factors = field_variable->arrayScalingFactor();
1519  _console << " " << field_variable->name() << ":";
1520  for (const auto i : make_range(field_variable->count()))
1521  _console << " " << factors[i];
1522  _console << "\n";
1523  }
1524  for (const auto & scalar_variable : scalar_variables)
1525  _console << " " << scalar_variable->name() << ": " << scalar_variable->scalingFactor()
1526  << "\n";
1527  _console << "\n" << std::endl;
1528 
1529  // restore state
1530  _console.flags(original_flags);
1531  _console.precision(original_precision);
1532  }
1533  }
1534 }
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)
inline

assign the maximum element dofs

Definition at line 597 of file SystemBase.h.

597 { _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)
inline

assign the maximum node dofs

Definition at line 602 of file SystemBase.h.

602 { _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 
)
virtual

Associate a matrix to a tag.

Reimplemented in DisplacedSystem.

Definition at line 1068 of file SystemBase.C.

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

1069 {
1070  if (!_subproblem.matrixTagExists(tag))
1071  mooseError("Cannot associate matrix to tag ", tag, " because that tag does not exist");
1072 
1073  if (_tagged_matrices.size() < tag + 1)
1074  _tagged_matrices.resize(tag + 1);
1075 
1076  _tagged_matrices[tag] = &matrix;
1077 }
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:333
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:328

◆ associateVectorToTag()

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

Associate a vector for a given tag.

Reimplemented in DisplacedSystem.

Definition at line 973 of file SystemBase.C.

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

974 {
975  if (!_subproblem.vectorTagExists(tag))
976  mooseError("Cannot associate vector to tag ", tag, " because that tag does not exist");
977 
978  if (_tagged_vectors.size() < tag + 1)
979  _tagged_vectors.resize(tag + 1);
980 
981  _tagged_vectors[tag] = &vec;
982 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
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)
virtual

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

Reimplemented in DisplacedSystem.

Definition at line 452 of file SystemBase.C.

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

453 {
454  std::set<dof_id_type> & ghosted_elems = _subproblem.ghostedElems();
455 
456  DofMap & dof_map = dofMap();
457 
458  std::vector<dof_id_type> dof_indices;
459 
460  System & sys = system();
461 
462  unsigned int sys_num = sys.number();
463 
464  unsigned int n_vars = sys.n_vars();
465 
466  for (const auto & elem_id : ghosted_elems)
467  {
468  Elem * elem = _mesh.elemPtr(elem_id);
469 
470  if (elem->active())
471  {
472  dof_map.dof_indices(elem, dof_indices);
473 
474  // Only need to ghost it if it's actually not on this processor
475  for (const auto & dof : dof_indices)
476  if (dof < dof_map.first_dof() || dof >= dof_map.end_dof())
477  send_list.push_back(dof);
478 
479  // Now add the DoFs from all of the nodes. This is necessary because of block
480  // restricted variables. A variable might not live _on_ this element but it
481  // might live on nodes connected to this element.
482  for (unsigned int n = 0; n < elem->n_nodes(); n++)
483  {
484  Node * node = elem->node_ptr(n);
485 
486  // Have to get each variable's dofs
487  for (unsigned int v = 0; v < n_vars; v++)
488  {
489  const Variable & var = sys.variable(v);
490  unsigned int var_num = var.number();
491  unsigned int n_comp = var.n_components();
492 
493  // See if this variable has any dofs at this node
494  if (node->n_dofs(sys_num, var_num) > 0)
495  {
496  // Loop over components of the variable
497  for (unsigned int c = 0; c < n_comp; c++)
498  send_list.push_back(node->dof_number(sys_num, var_num, c));
499  }
500  }
501  }
502  }
503  }
504 }
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:3113
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:1155
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()

virtual void SystemBase::augmentSparsity ( libMesh::SparsityPattern::Graph sparsity,
std::vector< dof_id_type > &  n_nz,
std::vector< dof_id_type > &  n_oz 
)
pure virtual

Will modify the sparsity pattern to add logical geometric connections.

Implemented in NonlinearSystemBase, DisplacedSystem, LinearSystem, and AuxiliarySystem.

Referenced by extraSparsity().

◆ automaticScaling() [1/2]

bool SystemBase::automaticScaling ( ) const
inline

Getter for whether we are performing automatic scaling.

Returns
whether we are performing automatic scaling

Definition at line 122 of file SystemBase.h.

Referenced by SubProblem::automaticScaling().

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

◆ automaticScaling() [2/2]

void SystemBase::automaticScaling ( bool  automatic_scaling)
inline

Setter for whether we are performing automatic scaling.

Parameters
automatic_scalingA boolean representing whether we are performing automatic scaling

Definition at line 128 of file SystemBase.h.

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

◆ clearAllDofIndices()

void SystemBase::clearAllDofIndices ( )

Clear all dof indices from moose variables.

Definition at line 1605 of file SystemBase.C.

Referenced by SubProblem::clearAllDofIndices().

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

◆ closeTaggedMatrices()

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

Close all matrices associated the tags.

Definition at line 1052 of file SystemBase.C.

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

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

◆ closeTaggedVector()

void SystemBase::closeTaggedVector ( const TagID  tag)

Close vector with the given tag.

Definition at line 649 of file SystemBase.C.

Referenced by closeTaggedVectors().

650 {
651  if (!_subproblem.vectorTagExists(tag))
652  mooseError("Cannot close vector with TagID ",
653  tag,
654  " in system '",
655  name(),
656  "' because that tag does not exist in the problem");
657  else if (!hasVector(tag))
658  mooseError("Cannot close vector tag with name '",
660  "' in system '",
661  name(),
662  "' because there is no vector associated with that tag");
663  getVector(tag).close();
664 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:916
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
virtual const std::string & name() const
Definition: SystemBase.C:1332
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:221
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:925

◆ closeTaggedVectors()

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

Close all vectors for given tags.

Definition at line 667 of file SystemBase.C.

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

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

◆ compute()

virtual void SystemBase::compute ( ExecFlagType  type)
pure virtual

Compute time derivatives, auxiliary variables, etc.

Parameters
typeOur current execution stage

Implemented in DisplacedSystem, LinearSystem, AuxiliarySystem, and SolverSystem.

◆ computeVariables()

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

Definition at line 869 of file SystemBase.h.

869 {}

◆ computingScalingJacobian()

bool SystemBase::computingScalingJacobian ( ) const

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

Definition at line 1544 of file SystemBase.C.

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

1545 {
1547 }
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

◆ copyOldSolutions()

void SystemBase::copyOldSolutions ( )
virtual

Shifts the solutions backwards in time.

Definition at line 1278 of file SystemBase.C.

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

1279 {
1280  // copy the solutions backward: current->old, old->older
1281  const auto states =
1282  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
1283  if (states > 1)
1284  for (unsigned int i = states - 1; i > 0; --i)
1285  solutionState(i) = solutionState(i - 1);
1286 
1287  if (solutionUDotOld())
1288  *solutionUDotOld() = *solutionUDot();
1289  if (solutionUDotDotOld())
1291 }
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:1423
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:264
virtual NumericVector< Number > * solutionUDot()
Definition: SystemBase.h:261
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:263
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:1084
virtual NumericVector< Number > * solutionUDotDot()
Definition: SystemBase.h:262

◆ copyPreviousFixedPointSolutions()

void SystemBase::copyPreviousFixedPointSolutions ( )
virtual

Definition at line 1294 of file SystemBase.C.

Referenced by FixedPointSolve::solveStep().

1295 {
1296  const auto n_states =
1297  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::FixedPoint)]
1298  .size();
1299  if (n_states > 1)
1300  for (unsigned int i = n_states - 1; i > 0; --i)
1303 }
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:1423
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:1084

◆ copyPreviousNonlinearSolutions()

void SystemBase::copyPreviousNonlinearSolutions ( )
virtual

Shifts the solutions backwards in nonlinear iteration history.

Definition at line 1261 of file SystemBase.C.

Referenced by copySolutionsBackwards().

1262 {
1263  const auto states =
1264  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Nonlinear)].size();
1265  if (states > 1)
1266  for (unsigned int i = states - 1; i > 0; --i)
1269 
1270  if (solutionPreviousNewton())
1272 }
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:1423
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:1084
virtual const NumericVector< Number > * solutionPreviousNewton() const
Definition: SystemBase.C:1347

◆ copySolutionsBackwards()

void SystemBase::copySolutionsBackwards ( )
virtual

Copy current solution into old and older.

Definition at line 1250 of file SystemBase.C.

1251 {
1252  system().update();
1253  copyOldSolutions();
1255 }
virtual void copyOldSolutions()
Shifts the solutions backwards in time.
Definition: SystemBase.C:1278
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:1261
virtual void update()

◆ copyTimeIntegrators()

void SystemBase::copyTimeIntegrators ( const SystemBase other_sys)

Copy time integrators from another system.

Definition at line 1659 of file SystemBase.C.

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

◆ copyVars()

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

Definition at line 1175 of file SystemBase.C.

1176 {
1177  int n_steps = io.get_num_time_steps();
1178 
1179  bool did_copy = false;
1180  for (const auto & vci : _var_to_copy)
1181  {
1182  int timestep = -1;
1183 
1184  if (vci._timestep == "LATEST")
1185  // Use the last time step in the file from which to retrieve the solution
1186  timestep = n_steps;
1187  else
1188  {
1189  timestep = MooseUtils::convert<int>(vci._timestep);
1190  if (timestep > n_steps)
1191  mooseError("Invalid value passed as \"initial_from_file_timestep\". Expected \"LATEST\" or "
1192  "a valid integer between 1 and ",
1193  n_steps,
1194  " inclusive, received ",
1195  vci._timestep);
1196  }
1197 
1198  did_copy = true;
1199 
1200  if (hasVariable(vci._dest_name))
1201  {
1202  const auto & var = getVariable(0, vci._dest_name);
1203  if (var.isArray())
1204  {
1205  const auto & array_var = getFieldVariable<RealEigenVector>(0, vci._dest_name);
1206  for (MooseIndex(var.count()) i = 0; i < var.count(); ++i)
1207  {
1208  const auto & exodus_var = var.arrayVariableComponent(i);
1209  const auto & system_var = array_var.componentName(i);
1210  if (var.isNodal())
1211  io.copy_nodal_solution(system(), exodus_var, system_var, timestep);
1212  else
1213  io.copy_elemental_solution(system(), exodus_var, system_var, timestep);
1214  }
1215  }
1216  else
1217  {
1218  if (var.isNodal())
1219  io.copy_nodal_solution(system(), vci._dest_name, vci._source_name, timestep);
1220  else
1221  io.copy_elemental_solution(system(), vci._dest_name, vci._source_name, timestep);
1222  }
1223  }
1224  else if (hasScalarVariable(vci._dest_name))
1225  io.copy_scalar_solution(system(), {vci._dest_name}, {vci._source_name}, timestep);
1226  else
1227  mooseError("Unrecognized variable ", vci._dest_name, " in variables to copy.");
1228  }
1229 
1230  if (did_copy)
1231  solution().close();
1232 }
NumericVector< Number > & solution()
Definition: SystemBase.h:196
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:1040
int convert< int >(const std::string &str, bool throw_on_failure)
Definition: MooseUtils.C:1009
void copy_nodal_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
void copy_elemental_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
Definition: SystemBase.C:843
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:90
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:868

◆ currentSolution()

virtual const NumericVector<Number>* const& SystemBase::currentSolution ( ) const
pure virtual

The solution vector that is currently being operated on.

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

Implemented in DisplacedSystem, SolverSystem, and AuxiliarySystem.

Referenced by copyPreviousNonlinearSolutions(), DisplacedSystem::currentSolution(), initialSetup(), MooseVariableScalar::reinit(), and restoreSolutions().

◆ customSetup()

void SystemBase::customSetup ( const ExecFlagType exec_type)
virtual

Reimplemented in NonlinearSystemBase, and AuxiliarySystem.

Definition at line 1577 of file SystemBase.C.

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

1578 {
1579  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1580  _vars[tid].customSetup(exec_type);
1581 }
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:1577
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ deactivateAllMatrixTags()

void SystemBase::deactivateAllMatrixTags ( )
virtual

Make matrices inactive.

Definition at line 1111 of file SystemBase.C.

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

1112 {
1113  auto num_matrix_tags = _subproblem.numMatrixTags();
1114 
1115  _matrix_tag_active_flags.resize(num_matrix_tags);
1116 
1117  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1118  _matrix_tag_active_flags[tag] = false;
1119  _active_tagged_matrices.clear();
1120 }
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
inlinevirtual

Get the default matrix tags associted with this system.

Reimplemented in NonlinearEigenSystem, and DisplacedSystem.

Definition at line 319 of file SystemBase.h.

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

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

◆ defaultVectorTags()

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

Get the default vector tags associated with this system.

Reimplemented in NonlinearEigenSystem, and DisplacedSystem.

Definition at line 312 of file SystemBase.h.

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

313  {
315  }
virtual TagID timeVectorTag() const
Ideally, we should not need this API.
Definition: SystemBase.h:292
virtual TagID nonTimeVectorTag() const
Definition: SystemBase.h:302
virtual TagID residualVectorTag() const
Definition: SystemBase.h:307

◆ disassociateDefaultMatrixTags()

void SystemBase::disassociateDefaultMatrixTags ( )
virtual

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

Reimplemented in DisplacedSystem.

Definition at line 1102 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultMatrixTags().

1103 {
1104  const auto tags = defaultMatrixTags();
1105  for (const auto tag : tags)
1106  if (_subproblem.matrixTagExists(tag))
1108 }
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1080
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:319
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ disassociateDefaultVectorTags()

void SystemBase::disassociateDefaultVectorTags ( )
virtual

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

Reimplemented in DisplacedSystem.

Definition at line 1007 of file SystemBase.C.

Referenced by DisplacedSystem::disassociateDefaultVectorTags().

1008 {
1009  const auto tags = defaultVectorTags();
1010  for (const auto tag : tags)
1011  if (_subproblem.vectorTagExists(tag))
1013 }
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:312

◆ disassociateMatrixFromTag() [1/2]

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

Disassociate a matrix from a tag.

Reimplemented in DisplacedSystem.

Definition at line 1080 of file SystemBase.C.

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

1081 {
1082  if (!_subproblem.matrixTagExists(tag))
1083  mooseError("Cannot disassociate matrix from tag ", tag, " because that tag does not exist");
1084  if (hasMatrix(tag) && &getMatrix(tag) != &matrix)
1085  mooseError("You can not disassociate a matrix from a tag which it was not associated to");
1086 
1088 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:360
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
Definition: SystemBase.C:1080
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:1016
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
Definition: SubProblem.C:328

◆ disassociateMatrixFromTag() [2/2]

void SystemBase::disassociateMatrixFromTag ( TagID  tag)
virtual

Disassociate any matrix that is associated with a given tag.

Reimplemented in DisplacedSystem.

Definition at line 1091 of file SystemBase.C.

1092 {
1093  if (!_subproblem.matrixTagExists(tag))
1094  mooseError("Cannot disassociate matrix from tag ", tag, " because that tag does not exist");
1095 
1096  if (_tagged_matrices.size() < tag + 1)
1097  _tagged_matrices.resize(tag + 1);
1098  _tagged_matrices[tag] = nullptr;
1099 }
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:333
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:328

◆ disassociateVectorFromTag() [1/2]

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

◆ disassociateVectorFromTag() [2/2]

void SystemBase::disassociateVectorFromTag ( TagID  tag)
virtual

Disassociate any vector that is associated with a given tag.

Reimplemented in DisplacedSystem.

Definition at line 996 of file SystemBase.C.

997 {
998  if (!_subproblem.vectorTagExists(tag))
999  mooseError("Cannot disassociate vector from tag ", tag, " because that tag does not exist");
1000 
1001  if (_tagged_vectors.size() < tag + 1)
1002  _tagged_vectors.resize(tag + 1);
1003  _tagged_vectors[tag] = nullptr;
1004 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
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 ( )
virtual

◆ dofMap() [2/2]

const DofMap & SystemBase::dofMap ( ) const
virtual

Gets const reference to the dof map.

Definition at line 1161 of file SystemBase.C.

1162 {
1163  return system().get_dof_map();
1164 }
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 ( )
inlinevirtual

Reimplemented in DisplacedSystem.

Definition at line 257 of file SystemBase.h.

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

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

◆ duDotDotDu() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 259 of file SystemBase.h.

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

◆ duDotDu()

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

Reimplemented in DisplacedSystem.

Definition at line 1693 of file SystemBase.C.

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

1694 {
1695  return _du_dot_du[var_num];
1696 }
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 ( )
inlinevirtual

Reimplemented in DisplacedSystem.

Definition at line 256 of file SystemBase.h.

Referenced by DisplacedSystem::duDotDus().

256 { 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 ( )
inline

Definition at line 103 of file SystemBase.h.

Referenced by DMMooseGetEmbedding_Private(), and DMSetUp_Moose_Pre().

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

◆ feProblem() [2/2]

const FEProblemBase& SystemBase::feProblem ( ) const
inline

Definition at line 104 of file SystemBase.h.

104 { 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)

flushes all matrices associated to tags.

Flush assembles the matrix but doesn't shrink memory allocation

Definition at line 1060 of file SystemBase.C.

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

◆ getActualFieldVariable() [1/2]

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

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

Definition at line 118 of file SystemBase.C.

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

119 {
120  return *_vars[tid].getActualFieldVariable<T>(var_name);
121 }
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 
)

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

Definition at line 139 of file SystemBase.C.

140 {
141  return *_vars[tid].getActualFieldVariable<T>(var_number);
142 }
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 
)

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

Referenced by Marker::getMarkerValue().

112 {
113  return *_vars[tid].getFieldVariable<T>(var_name);
114 }
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 
)

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

133 {
134  return *_vars[tid].getFieldVariable<T>(var_number);
135 }
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 
)

Return a finite volume variable.

Definition at line 125 of file SystemBase.C.

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

◆ getMatrix() [1/2]

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

Get a raw SparseMatrix.

Reimplemented in DisplacedSystem.

Definition at line 1016 of file SystemBase.C.

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

1017 {
1018  if (!hasMatrix(tag))
1019  {
1020  if (!_subproblem.matrixTagExists(tag))
1021  mooseError("Cannot retreive matrix with tag ", tag, " because that tag does not exist");
1022  else
1023  mooseError("Cannot retreive matrix with tag ",
1024  tag,
1025  " in system '",
1026  name(),
1027  "'\nbecause a matrix has not been associated with that tag.");
1028  }
1029 
1030  return *_tagged_matrices[tag];
1031 }
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:333
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:360
virtual const std::string & name() const
Definition: SystemBase.C:1332
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:328

◆ getMatrix() [2/2]

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

Get a raw SparseMatrix.

Reimplemented in DisplacedSystem.

Definition at line 1034 of file SystemBase.C.

1035 {
1036  if (!hasMatrix(tag))
1037  {
1038  if (!_subproblem.matrixTagExists(tag))
1039  mooseError("Cannot retreive matrix with tag ", tag, " because that tag does not exist");
1040  else
1041  mooseError("Cannot retreive matrix with tag ",
1042  tag,
1043  " in system '",
1044  name(),
1045  "'\nbecause a matrix has not been associated with that tag.");
1046  }
1047 
1048  return *_tagged_matrices[tag];
1049 }
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:333
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.h:360
virtual const std::string & name() const
Definition: SystemBase.C:1332
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:328

◆ getMaxVariableNumber()

unsigned int SystemBase::getMaxVariableNumber ( ) const
inline

Returns the maximum number of all variables on the system.

Definition at line 867 of file SystemBase.h.

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

◆ getMaxVarNDofsPerElem()

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

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

Returns
The max

Definition at line 585 of file SystemBase.h.

Referenced by Moose::globalDofIndexToDerivative().

585 { 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
inline

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

Returns
The max

Definition at line 592 of file SystemBase.h.

592 { 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 ( )
virtual

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

Returns
The minimal order of quadrature

Reimplemented in AuxiliarySystem.

Definition at line 241 of file SystemBase.C.

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

◆ getScalarVariable() [1/2]

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

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 145 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().

146 {
147  MooseVariableScalar * var = dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_name));
148  if (!var)
149  mooseError("Scalar variable '" + var_name + "' does not exist in this system");
150  return *var;
151 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
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
virtual

Gets a reference to a variable with specified number.

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

Definition at line 154 of file SystemBase.C.

155 {
156  MooseVariableScalar * var =
157  dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_number));
158  if (!var)
159  mooseError("variable #" + Moose::stringify(var_number) + " does not exist in this system");
160  return *var;
161 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
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)
inline

◆ getStandardFieldVariableNames()

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

◆ getSubdomainsForVar() [1/2]

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

Definition at line 761 of file SystemBase.h.

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

762  {
763  return _var_map.at(var_number);
764  }
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

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

1700 {
1701  return getSubdomainsForVar(getVariable(0, var_name).number());
1702 }
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1149
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
Definition: SystemBase.h:761
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:90

◆ getTimeIntegrator()

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

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

Definition at line 1675 of file SystemBase.C.

Referenced by AB2PredictorCorrector::estimateTimeError().

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

◆ getTimeIntegrators()

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

Definition at line 1687 of file SystemBase.C.

1688 {
1689  return _time_integrators;
1690 }
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

Gets a reference to a variable of with specified name.

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

Definition at line 90 of file SystemBase.C.

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

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

Gets a reference to a variable with specified number.

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

Definition at line 100 of file SystemBase.C.

101 {
102  if (var_number < _numbered_vars[tid].size())
103  if (_numbered_vars[tid][var_number])
104  return *_numbered_vars[tid][var_number];
105 
106  mooseError("Variable #", Moose::stringify(var_number), " does not exist in this system");
107 }
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:333
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64

◆ getVariableBlocks()

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

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

Referenced by PhysicsBasedPreconditioner::addSystem().

165 {
166  mooseAssert(_var_map.find(var_number) != _var_map.end(), "Variable does not exist.");
167  if (_var_map[var_number].empty())
168  return nullptr;
169  else
170  return &_var_map[var_number];
171 }
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 ( )
inline

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

Definition at line 842 of file SystemBase.h.

842 { 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
inline

◆ getVariables()

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

◆ getVector() [1/4]

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

Get a raw NumericVector by name.

Get a raw NumericVector with the given name.

Reimplemented in DisplacedSystem.

Definition at line 925 of file SystemBase.C.

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

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

◆ getVector() [2/4]

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

Reimplemented in DisplacedSystem.

Definition at line 931 of file SystemBase.C.

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

◆ getVector() [3/4]

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

Get a raw NumericVector by tag.

Reimplemented in DisplacedSystem.

Definition at line 937 of file SystemBase.C.

938 {
939  if (!hasVector(tag))
940  {
941  if (!_subproblem.vectorTagExists(tag))
942  mooseError("Cannot retreive vector with tag ", tag, " because that tag does not exist");
943  else
944  mooseError("Cannot retreive vector with tag ",
945  tag,
946  " in system '",
947  name(),
948  "'\nbecause a vector has not been associated with that tag.");
949  }
950 
951  return *_tagged_vectors[tag];
952 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:916
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
virtual const std::string & name() const
Definition: SystemBase.C:1332
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
virtual

Reimplemented in DisplacedSystem.

Definition at line 955 of file SystemBase.C.

956 {
957  if (!hasVector(tag))
958  {
959  if (!_subproblem.vectorTagExists(tag))
960  mooseError("Cannot retreive vector with tag ", tag, " because that tag does not exist");
961  else
962  mooseError("Cannot retreive vector with tag ",
963  tag,
964  " in system '",
965  name(),
966  "'\nbecause a vector has not been associated with that tag.");
967  }
968 
969  return *_tagged_vectors[tag];
970 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:916
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
virtual const std::string & name() const
Definition: SystemBase.C:1332
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

◆ gradientContainer()

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

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

Mainly used for finite volume systems.

Definition at line 930 of file SystemBase.h.

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

◆ hasMatrix()

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

◆ hasScalarVariable()

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

Definition at line 868 of file SystemBase.C.

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

869 {
870  if (system().has_variable(var_name))
871  return system().variable_type(var_name).family == SCALAR;
872  else
873  return false;
874 }
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
inlinevirtual

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

Reimplemented in DisplacedSystem.

Definition at line 1090 of file SystemBase.h.

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

1092 {
1093  return _solution_states[static_cast<unsigned short>(iteration_type)].size() > state;
1094 }
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:1084

◆ hasVarCopy()

bool SystemBase::hasVarCopy ( ) const
inline

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

Definition at line 883 of file SystemBase.h.

883 { 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
virtual

Query a system for a variable.

Parameters
var_namename of the variable
Returns
true if the variable exists

Definition at line 843 of file SystemBase.C.

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

844 {
845  auto & names = getVariableNames();
846  if (system().has_variable(var_name))
847  return system().variable_type(var_name).family != SCALAR;
848  if (std::find(names.begin(), names.end(), var_name) != names.end())
849  // array variable
850  return true;
851  else
852  return false;
853 }
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:860

◆ hasVector() [1/2]

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

◆ hasVector() [2/2]

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

Check if the tagged vector exists in the system.

Reimplemented in DisplacedSystem.

Definition at line 281 of file SystemBase.h.

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

◆ initializeObjects()

virtual void SystemBase::initializeObjects ( )
inlinevirtual

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

Definition at line 173 of file SystemBase.h.

173 {}

◆ initialSetup()

void SystemBase::initialSetup ( )
virtual

Setup Functions.

Reimplemented in NonlinearSystemBase, LinearSystem, and AuxiliarySystem.

Definition at line 1550 of file SystemBase.C.

Referenced by AuxiliarySystem::initialSetup(), LinearSystem::initialSetup(), and NonlinearSystemBase::initialSetup().

1551 {
1552  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1553  _vars[tid].initialSetup();
1554 
1555  // If we need raw gradients, we initialize them here.
1556  bool gradient_storage_initialized = false;
1557  for (const auto & field_var : _vars[0].fieldVariables())
1558  if (!gradient_storage_initialized && field_var->needsGradientVectorStorage())
1559  {
1560  _raw_grad_container.clear();
1561  for (const auto i : make_range(this->_mesh.dimension()))
1562  {
1563  libmesh_ignore(i);
1564  _raw_grad_container.push_back(currentSolution()->zero_clone());
1565  }
1566  }
1567 }
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
unsigned int n_threads()
std::vector< std::unique_ptr< NumericVector< Number > > > _raw_grad_container
A cache for storing gradients at dof locations.
Definition: SystemBase.h:1073
void libmesh_ignore(const Args &...)
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
Definition: MooseMesh.C:2928
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
MooseMesh & _mesh
Definition: SystemBase.h:991
IntRange< T > make_range(T beg, T end)
virtual void initialSetup()
Setup Functions.
Definition: SystemBase.C:1550
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ initSolutionState()

void SystemBase::initSolutionState ( )
virtual

Initializes the solution state.

Reimplemented in DisplacedSystem.

Definition at line 1356 of file SystemBase.C.

Referenced by DisplacedSystem::initSolutionState().

1357 {
1358  // Default is the current solution
1359  unsigned int state = 0;
1360 
1361  // Add additional states as required by the variable states requested
1362  for (const auto & var : getVariables(/* tid = */ 0))
1363  state = std::max(state, var->oldestSolutionStateRequested());
1364  for (const auto & var : getScalarVariables(/* tid = */ 0))
1365  state = std::max(state, var->oldestSolutionStateRequested());
1366 
1368 
1370 }
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)
Definition: SystemBase.h:751
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Definition: SystemBase.h:756
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:1442

◆ isArrayVariable()

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

If a variable is an array variable.

Definition at line 856 of file SystemBase.C.

857 {
858  auto & names = getVariableNames();
859  if (!system().has_variable(var_name) &&
860  std::find(names.begin(), names.end(), var_name) != names.end())
861  // array variable
862  return true;
863  else
864  return false;
865 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:860

◆ isScalarVariable()

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

Definition at line 877 of file SystemBase.C.

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

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

◆ jacobianSetup()

void SystemBase::jacobianSetup ( )
virtual

Reimplemented in NonlinearSystemBase, LinearSystem, and AuxiliarySystem.

Definition at line 1598 of file SystemBase.C.

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

1599 {
1600  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1601  _vars[tid].jacobianSetup();
1602 }
unsigned int n_threads()
virtual void jacobianSetup()
Definition: SystemBase.C:1598
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ matrixTagActive()

bool SystemBase::matrixTagActive ( TagID  tag) const
virtual

If or not a matrix tag is active.

Definition at line 1141 of file SystemBase.C.

1142 {
1143  mooseAssert(_subproblem.matrixTagExists(tag), "Matrix tag " << tag << " does not exist");
1144 
1145  return tag < _matrix_tag_active_flags.size() && _matrix_tag_active_flags[tag];
1146 }
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:328

◆ mesh() [1/2]

MooseMesh& SystemBase::mesh ( )
inline

◆ mesh() [2/2]

const MooseMesh& SystemBase::mesh ( ) const
inline

Definition at line 100 of file SystemBase.h.

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

◆ name()

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

Definition at line 1332 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(), addMatrix(), NonlinearSystemBase::addNodalKernel(), AuxiliarySystem::addScalarKernel(), NonlinearSystemBase::addScalarKernel(), NonlinearSystemBase::addSplit(), addTimeIntegrator(), AuxiliarySystem::addVariable(), addVariable(), DiffusionLHDGAssemblyHelper::checkCoupling(), closeTaggedVector(), LinearSystem::computeGradients(), LinearSystem::computeLinearSystemTags(), DisplacedProblem::DisplacedProblem(), getMatrix(), NonlinearSystemBase::getSplit(), DisplacedSystem::getVector(), getVector(), hasVector(), LinearSystem::initialSetup(), Moose::PetscSupport::petscSetDefaults(), NonlinearEigenSystem::postAddResidualObject(), MooseStaticCondensationPreconditioner::prefix(), removeMatrix(), removeVector(), solutionState(), LinearSystem::solve(), LinearTimeIntegratorInterface::timeDerivativeMatrixContribution(), LinearTimeIntegratorInterface::timeDerivativeRHSContribution(), and zeroTaggedVector().

1333 {
1334  return system().name();
1335 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
const std::string & name() const

◆ needSolutionState()

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

Registers that the solution state state is needed.

Reimplemented in DisplacedSystem.

Definition at line 1442 of file SystemBase.C.

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

1445 {
1446  libmesh_parallel_only(this->comm());
1447  mooseAssert(!Threads::in_threads,
1448  "This routine is not thread-safe. Request the solution state before using it in "
1449  "a threaded region.");
1450 
1451  if (hasSolutionState(state, iteration_type))
1452  return;
1453 
1454  auto & solution_states = _solution_states[static_cast<unsigned short>(iteration_type)];
1455  solution_states.resize(state + 1);
1456 
1457  // The 0-th (current) solution state is owned by libMesh
1458  if (!solution_states[0])
1459  solution_states[0] = &solutionInternal();
1460  else
1461  mooseAssert(solution_states[0] == &solutionInternal(), "Inconsistent current solution");
1462 
1463  // We will manually add all states past current
1464  for (unsigned int i = 1; i <= state; ++i)
1465  if (!solution_states[i])
1466  {
1467  auto tag = _subproblem.addVectorTag(oldSolutionStateVectorName(i, iteration_type),
1469  solution_states[i] = &addVector(tag, true, parallel_type);
1470  }
1471  else
1472  {
1473  // If the existing parallel type is PARALLEL and GHOSTED is now requested,
1474  // this would require an upgrade, which is risky if anybody has already
1475  // stored a pointer to the existing vector, since the upgrade would create
1476  // a new vector and make that pointer null. If the existing parallel type
1477  // is GHOSTED and PARALLEL is now requested, we don't need to do anything.
1478  if (parallel_type == GHOSTED && solutionStateParallelType(i, iteration_type) == PARALLEL)
1479  mooseError("The solution state has already been declared as PARALLEL");
1480 
1481  mooseAssert(solution_states[i] == &getVector(oldSolutionStateVectorName(i, iteration_type)),
1482  "Inconsistent solution state");
1483  }
1484 }
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:333
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition: SubProblem.C:92
const Parallel::Communicator & comm() const
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h: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:1090
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:1373
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:1432
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:1084
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:925

◆ nFieldVariables()

unsigned int SystemBase::nFieldVariables ( ) const

Get the number of field variables in this system.

Returns
the number of field variables

Definition at line 892 of file SystemBase.C.

Referenced by nVariables().

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

◆ nFVVariables()

unsigned int SystemBase::nFVVariables ( ) const

Get the number of finite volume variables in this system.

Returns
the number of finite volume variables

Definition at line 902 of file SystemBase.C.

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

◆ nonTimeVectorTag()

virtual TagID SystemBase::nonTimeVectorTag ( ) const
inlinevirtual

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 302 of file SystemBase.h.

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

302 { 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:333

◆ number()

unsigned int SystemBase::number ( ) const

Gets the number of this system.

Returns
The number of this system

Definition at line 1149 of file SystemBase.C.

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

1150 {
1151  return system().number();
1152 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
unsigned int number() const

◆ nVariables()

unsigned int SystemBase::nVariables ( ) const
virtual

Get the number of variables in this system.

Returns
the number of variables

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

884 {
885  unsigned int n = nFieldVariables();
886  n += _vars[0].scalars().size();
887 
888  return n;
889 }
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:892

◆ oldSolutionStateVectorName()

TagName SystemBase::oldSolutionStateVectorName ( const unsigned int  state,
Moose::SolutionIterationType  iteration_type 
) const
private

Gets the vector name used for an old (not current) solution state.

Definition at line 1373 of file SystemBase.C.

Referenced by needSolutionState(), and solutionState().

1375 {
1376  mooseAssert(state != 0, "Not an old state");
1377 
1378  if (iteration_type == Moose::SolutionIterationType::Time)
1379  {
1380  if (state == 1)
1381  return Moose::OLD_SOLUTION_TAG;
1382  else if (state == 2)
1384  }
1385  else if (iteration_type == Moose::SolutionIterationType::Nonlinear && state == 1)
1387  else if (iteration_type == Moose::SolutionIterationType::FixedPoint && state == 1)
1389 
1390  return "solution_state_" + std::to_string(state) + "_" + Moose::stringify(iteration_type);
1391 }
const TagName OLDER_SOLUTION_TAG
Definition: MooseTypes.C:27
const TagName PREVIOUS_FP_SOLUTION_TAG
Definition: MooseTypes.C:29
const TagName OLD_SOLUTION_TAG
Definition: MooseTypes.C:26
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
const TagName PREVIOUS_NL_SOLUTION_TAG
Definition: MooseTypes.C:28

◆ postInit()

virtual void SystemBase::postInit ( )
inlinevirtual

Reimplemented in NonlinearEigenSystem.

Definition at line 162 of file SystemBase.h.

Referenced by NonlinearEigenSystem::postInit().

162 {}

◆ prefix()

std::string SystemBase::prefix ( ) const
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 1705 of file SystemBase.C.

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

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

◆ preInit()

virtual void SystemBase::preInit ( )
inlinevirtual

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

Definition at line 156 of file SystemBase.h.

Referenced by SolverSystem::preInit().

156 {}

◆ prepare()

void SystemBase::prepare ( THREAD_ID  tid)
virtual

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 256 of file SystemBase.C.

Referenced by SubProblem::reinitElemFaceRef().

257 {
259  {
260  const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
262  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
263  for (const auto & var : vars)
264  var->clearDofIndices();
265 
266  for (const auto & var : active_elemental_moose_variables)
267  if (&(var->sys()) == this)
268  var->prepare();
269  }
270  else
271  {
272  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
273  for (const auto & var : vars)
274  var->prepare();
275  }
276 }
char ** vars
virtual const std::set< MooseVariableFieldBase * > & getActiveElementalMooseVariables(const THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:454
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
Definition: SystemBase.h: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:460

◆ prepareFace()

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

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

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

◆ prepareLowerD()

void SystemBase::prepareLowerD ( THREAD_ID  tid)
virtual

Prepare the system for use for lower dimensional elements.

Parameters
tidID of the thread

Definition at line 332 of file SystemBase.C.

Referenced by SubProblem::reinitLowerDElem().

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

◆ prepareNeighbor()

void SystemBase::prepareNeighbor ( THREAD_ID  tid)
virtual

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 324 of file SystemBase.C.

Referenced by SubProblem::reinitNeighborFaceRef().

325 {
326  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
327  for (const auto & var : vars)
328  var->prepareNeighbor();
329 }
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

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

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

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

◆ reinit()

virtual void SystemBase::reinit ( )
inlinevirtual

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

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

Reimplemented in NonlinearEigenSystem.

Definition at line 168 of file SystemBase.h.

Referenced by NonlinearEigenSystem::reinit().

168 {}

◆ reinitElem()

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

Reinit an element assembly info.

Parameters
elemWhich element we are reinitializing for
tidID of the thread

Reimplemented in AuxiliarySystem.

Definition at line 340 of file SystemBase.C.

341 {
343  {
344  const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
346  for (const auto & var : active_elemental_moose_variables)
347  if (&(var->sys()) == this)
348  var->computeElemValues();
349  }
350  else
351  {
352  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
353  for (const auto & var : vars)
354  var->computeElemValues();
355  }
356 
357  if (system().has_static_condensation())
358  for (auto & [tag, matrix] : _active_tagged_matrices)
359  {
360  libmesh_ignore(tag);
361  cast_ptr<StaticCondensation *>(matrix)->set_current_elem(*elem);
362  }
363 }
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:454
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:460

◆ reinitElemFace()

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

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

Referenced by SubProblem::reinitElemFaceRef().

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

◆ reinitLowerD()

void SystemBase::reinitLowerD ( THREAD_ID  tid)
virtual

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

Definition at line 390 of file SystemBase.C.

Referenced by SubProblem::reinitLowerDElem().

391 {
392  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
393  for (const auto & var : vars)
394  var->computeLowerDValues();
395 }
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 
)
virtual

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

Definition at line 382 of file SystemBase.C.

383 {
384  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
385  for (const auto & var : vars)
386  var->computeNeighborValues();
387 }
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 
)
virtual

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

Definition at line 374 of file SystemBase.C.

Referenced by SubProblem::reinitNeighborFaceRef().

375 {
376  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
377  for (const auto & var : vars)
378  var->computeNeighborValuesFace();
379 }
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 
)
virtual

Reinit nodal assembly info.

Parameters
nodeNode to reinit for
tidThread ID

Definition at line 398 of file SystemBase.C.

399 {
400  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
401  for (const auto & var : vars)
402  {
403  var->reinitNode();
404  if (var->isNodalDefined())
405  var->computeNodalValues();
406  }
407 }
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 
)
virtual

Reinit nodal assembly info on a face.

Parameters
nodeNode to reinit
bnd_idBoundary ID
tidThread ID

Definition at line 410 of file SystemBase.C.

411 {
412  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
413  for (const auto & var : vars)
414  {
415  var->reinitNode();
416  if (var->isNodalDefined())
417  var->computeNodalValues();
418  }
419 }
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 
)
virtual

Reinit variables at a set of nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 422 of file SystemBase.C.

423 {
424  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
425  for (const auto & var : vars)
426  {
427  var->reinitNodes(nodes);
428  var->computeNodalValues();
429  }
430 }
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 
)
virtual

Reinit variables at a set of neighbor nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 433 of file SystemBase.C.

434 {
435  const std::vector<MooseVariableFieldBase *> & vars = _vars[tid].fieldVariables();
436  for (const auto & var : vars)
437  {
438  var->reinitNodesNeighbor(nodes);
439  var->computeNodalNeighborValues();
440  }
441 }
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 
)
virtual

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

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

◆ removeMatrix()

void SystemBase::removeMatrix ( TagID  tag)

Removes a matrix with a given tag.

Parameters
tag_nameThe name of the tag

Definition at line 590 of file SystemBase.C.

591 {
592  if (!_subproblem.matrixTagExists(tag_id))
593  mooseError("Cannot remove the matrix with TagID ",
594  tag_id,
595  "\nin system '",
596  name(),
597  "', because that tag does not exist in the problem");
598 
599  if (hasMatrix(tag_id))
600  {
601  const auto matrix_name = _subproblem.matrixTagName(tag_id);
602  system().remove_matrix(matrix_name);
603  _tagged_matrices[tag_id] = nullptr;
604  }
605 }
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:333
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:360
virtual const std::string & name() const
Definition: SystemBase.C:1332
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:328
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:357

◆ removeVector() [1/2]

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

Remove a vector from the system with the given name.

Definition at line 1326 of file SystemBase.C.

Referenced by restoreOldSolutions().

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

◆ removeVector() [2/2]

void SystemBase::removeVector ( TagID  tag_id)

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

Parameters
tag_idTag ID

Definition at line 700 of file SystemBase.C.

701 {
702  if (!_subproblem.vectorTagExists(tag_id))
703  mooseError("Cannot remove the vector with TagID ",
704  tag_id,
705  "\nin system '",
706  name(),
707  "', because that tag does not exist in the problem");
708 
709  if (hasVector(tag_id))
710  {
711  auto vector_name = _subproblem.vectorTagName(tag_id);
712  system().remove_vector(vector_name);
713  _tagged_vectors[tag_id] = nullptr;
714  }
715 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:916
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual const std::string & name() const
Definition: SystemBase.C:1332
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:221
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:1021

◆ residualCopy()

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

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 426 of file SystemBase.h.

Referenced by DisplacedSystem::residualCopy().

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

◆ residualGhosted()

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

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 430 of file SystemBase.h.

Referenced by DisplacedSystem::residualGhosted().

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

◆ residualSetup()

void SystemBase::residualSetup ( )
virtual

Reimplemented in NonlinearSystemBase, LinearSystem, and AuxiliarySystem.

Definition at line 1591 of file SystemBase.C.

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

1592 {
1593  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1594  _vars[tid].residualSetup();
1595 }
unsigned int n_threads()
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:996
virtual void residualSetup()
Definition: SystemBase.C:1591
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ residualVectorTag()

virtual TagID SystemBase::residualVectorTag ( ) const
inlinevirtual

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 307 of file SystemBase.h.

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

307 { 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:333

◆ restoreOldSolutions()

void SystemBase::restoreOldSolutions ( )
virtual

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

Definition at line 542 of file SystemBase.C.

543 {
544  const auto states =
545  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
546  if (states > 1)
547  for (unsigned int i = 1; i <= states - 1; ++i)
548  if (_saved_solution_states[i])
549  {
551  removeVector("save_solution_state_" + std::to_string(i));
552  _saved_solution_states[i] = nullptr;
553  }
554 
556  {
558  removeVector("save_solution_dot_old");
559  _saved_dot_old = nullptr;
560  }
562  {
564  removeVector("save_solution_dotdot_old");
565  _saved_dotdot_old = nullptr;
566  }
567 }
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:1423
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:264
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:263
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:1326
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:1084
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1086

◆ restoreSolutions()

void SystemBase::restoreSolutions ( )
virtual

Restore current solutions (call after your solve failed)

Reimplemented in SolverSystem.

Definition at line 1309 of file SystemBase.C.

Referenced by SolverSystem::restoreSolutions().

1310 {
1311  if (!hasSolutionState(1))
1312  mooseError("Cannot restore solutions without old solution");
1313 
1314  *(const_cast<NumericVector<Number> *&>(currentSolution())) = solutionOld();
1315  solution() = solutionOld();
1316  if (solutionUDotOld())
1317  *solutionUDot() = *solutionUDotOld();
1318  if (solutionUDotDotOld())
1320  if (solutionPreviousNewton())
1322  system().update();
1323 }
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
NumericVector< Number > & solution()
Definition: SystemBase.h:196
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:264
virtual NumericVector< Number > * solutionUDot()
Definition: SystemBase.h:261
virtual NumericVector< Number > * solutionUDotOld()
Definition: SystemBase.h:263
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:1090
virtual void update()
virtual const NumericVector< Number > * solutionPreviousNewton() const
Definition: SystemBase.C:1347
virtual NumericVector< Number > * solutionUDotDot()
Definition: SystemBase.h:262
NumericVector< Number > & solutionOld()
Definition: SystemBase.h:197

◆ saveOldSolutions()

void SystemBase::saveOldSolutions ( )
virtual

Save the old and older solutions.

Definition at line 510 of file SystemBase.C.

511 {
512  const auto states =
513  _solution_states[static_cast<unsigned short>(Moose::SolutionIterationType::Time)].size();
514  if (states > 1)
515  {
516  _saved_solution_states.resize(states);
517  for (unsigned int i = 1; i <= states - 1; ++i)
518  if (!_saved_solution_states[i])
520  &addVector("save_solution_state_" + std::to_string(i), false, PARALLEL);
521 
522  for (unsigned int i = 1; i <= states - 1; ++i)
524  }
525 
527  _saved_dot_old = &addVector("save_solution_dot_old", false, PARALLEL);
529  _saved_dotdot_old = &addVector("save_solution_dotdot_old", false, PARALLEL);
530 
531  if (solutionUDotOld())
533 
534  if (solutionUDotDotOld())
536 }
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:1423
virtual NumericVector< Number > * solutionUDotDotOld()
Definition: SystemBase.h:264
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:263
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:1084
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
Definition: SystemBase.h:1086

◆ serializedSolution()

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

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

Reimplemented in DisplacedSystem.

Definition at line 1638 of file SystemBase.C.

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

1639 {
1640  if (!_serialized_solution.get())
1641  {
1643  _serialized_solution->init(system().n_dofs(), false, SERIAL);
1644  }
1645 
1646  return *_serialized_solution;
1647 }
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

◆ setActiveScalarVariableCoupleableVectorTags()

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

Set the active vector tags for the scalar variables.

Definition at line 1618 of file SystemBase.C.

Referenced by SubProblem::setActiveScalarVariableCoupleableVectorTags().

1620 {
1621  _vars[tid].setActiveScalarVariableCoupleableVectorTags(vtags);
1622 }
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 
)

Set the active vector tags for the variables.

Definition at line 1612 of file SystemBase.C.

Referenced by SubProblem::setActiveFEVariableCoupleableVectorTags().

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

◆ setVariableGlobalDoFs()

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

set all the global dof indices for a variable

Parameters
var_nameThe name of the variable

Definition at line 186 of file SystemBase.C.

187 {
188  AllLocalDofIndicesThread aldit(_subproblem, {var_name});
190  Threads::parallel_reduce(elem_range, aldit);
191 
192  // Gather the dof indices across procs to get all the dof indices for var_name
193  aldit.dofIndicesSetUnion();
194 
195  const auto & all_dof_indices = aldit.getDofIndices();
196  _var_all_dof_indices.assign(all_dof_indices.begin(), all_dof_indices.end());
197 }
libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:1238
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 &)
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)
inline

Sets the verbose flag.

Parameters
[in]verboseVerbose flag

Definition at line 134 of file SystemBase.h.

Referenced by Executioner::Executioner().

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

◆ sizeVariableMatrixData()

void SystemBase::sizeVariableMatrixData ( )

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

Definition at line 1711 of file SystemBase.C.

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

◆ solution() [1/2]

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

Definition at line 196 of file SystemBase.h.

Referenced by Adaptivity::adaptMesh(), TransientMultiApp::appTransferVector(), MooseEigenSystem::combineSystemSolution(), NonlinearSystemBase::computeDamping(), AuxiliarySystem::computeElementalVarsHelper(), NonlinearSystemBase::computeJacobianInternal(), AuxiliarySystem::computeMortarNodalVars(), NonlinearSystemBase::computeNodalBCs(), AuxiliarySystem::computeNodalVarsHelper(), NonlinearSystemBase::computeResidualTags(), AuxiliarySystem::computeScalarVars(), NonlinearSystemBase::constraintResiduals(), copyVars(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), NodalNormalsCorner::execute(), NodalNormalsEvaluator::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), NodalNormalsPreprocessor::execute(), NodalNormalsCorner::finalize(), NodalNormalsEvaluator::finalize(), NodalNormalsPreprocessor::finalize(), NodalNormalsEvaluator::initialize(), NodalNormalsCorner::initialize(), NodalNormalsPreprocessor::initialize(), MooseEigenSystem::initSystemSolution(), ComputeMarkerThread::onElement(), ComputeIndicatorThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeNodalUserObjectsThread::onNode(), FEProblemBase::projectInitialConditionOnCustomRange(), FEProblemBase::projectSolution(), Transient::relativeSolutionDifferenceNorm(), MultiApp::restore(), restoreSolutions(), 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 zeroVariables().

196 { 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:1423

◆ solution() [2/2]

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

Definition at line 199 of file SystemBase.h.

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

◆ solutionInternal()

virtual NumericVector<Number>& SystemBase::solutionInternal ( ) const
protectedpure virtual

Internal getter for solution owned by libMesh.

Implemented in DisplacedSystem, AuxiliarySystem, and SolverSystem.

Referenced by needSolutionState(), and solutionState().

◆ solutionOld() [1/2]

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

◆ solutionOld() [2/2]

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

Definition at line 200 of file SystemBase.h.

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

◆ solutionOlder() [1/2]

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

Definition at line 198 of file SystemBase.h.

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

198 { 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:1423

◆ solutionOlder() [2/2]

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

Definition at line 201 of file SystemBase.h.

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

◆ solutionPreviousNewton() [1/2]

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

Reimplemented in DisplacedSystem.

Definition at line 1347 of file SystemBase.C.

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

1348 {
1351  else
1352  return nullptr;
1353 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:916
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:925

◆ solutionPreviousNewton() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 1338 of file SystemBase.C.

1339 {
1342  else
1343  return nullptr;
1344 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:916
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:925

◆ solutionState() [1/2]

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

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

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

1425 {
1426  if (!hasSolutionState(state, iteration_type))
1427  needSolutionState(state, iteration_type);
1428  return *_solution_states[static_cast<unsigned short>(iteration_type)][state];
1429 }
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:1090
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: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:1084

◆ solutionState() [2/2]

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

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

Reimplemented in DisplacedSystem.

Definition at line 1394 of file SystemBase.C.

1396 {
1397  if (!hasSolutionState(state, iteration_type))
1398  mooseError("For iteration type '",
1399  Moose::stringify(iteration_type),
1400  "': solution state ",
1401  state,
1402  " was requested in ",
1403  name(),
1404  " but only up to state ",
1405  (_solution_states[static_cast<unsigned short>(iteration_type)].size() == 0)
1406  ? 0
1407  : _solution_states[static_cast<unsigned short>(iteration_type)].size() - 1,
1408  " is available.");
1409 
1410  const auto & solution_states = _solution_states[static_cast<unsigned short>(iteration_type)];
1411 
1412  if (state == 0)
1413  mooseAssert(solution_states[0] == &solutionInternal(), "Inconsistent current solution");
1414  else
1415  mooseAssert(solution_states[state] ==
1416  &getVector(oldSolutionStateVectorName(state, iteration_type)),
1417  "Inconsistent solution state");
1418 
1419  return *solution_states[state];
1420 }
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:333
virtual const std::string & name() const
Definition: SystemBase.C:1332
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:1090
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:1373
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:1084
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:925

◆ solutionStateParallelType()

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

Returns the parallel type of the given solution state.

Definition at line 1432 of file SystemBase.C.

Referenced by needSolutionState().

1434 {
1435  if (!hasSolutionState(state, iteration_type))
1436  mooseError("solutionStateParallelType() may only be called if the solution state exists.");
1437 
1438  return _solution_states[static_cast<unsigned short>(iteration_type)][state]->type();
1439 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
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:1090
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:1084

◆ solutionStatesInitialized()

bool SystemBase::solutionStatesInitialized ( ) const
inline

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 896 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 ( )
inlinevirtual

◆ solutionUDot() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 265 of file SystemBase.h.

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

◆ solutionUDotDot() [1/2]

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

◆ solutionUDotDot() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 266 of file SystemBase.h.

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

◆ solutionUDotDotOld() [1/2]

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

◆ solutionUDotDotOld() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 268 of file SystemBase.h.

268 { 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 ( )
inlinevirtual

◆ solutionUDotOld() [2/2]

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

Reimplemented in DisplacedSystem.

Definition at line 267 of file SystemBase.h.

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

◆ solve()

void SystemBase::solve ( )
virtual

Solve the system (using libMesh magic)

Reimplemented in NonlinearSystemBase, LinearSystem, NonlinearEigenSystem, NonlinearSystem, DumpObjectsLinearSystem, and DumpObjectsNonlinearSystem.

Definition at line 1241 of file SystemBase.C.

1242 {
1243  system().solve();
1244 }
virtual libMesh::System & system()=0
Get the reference to the libMesh system.
virtual void solve()

◆ subdomainSetup()

void SystemBase::subdomainSetup ( )
virtual

Reimplemented in AuxiliarySystem.

Definition at line 1584 of file SystemBase.C.

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

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

◆ subproblem() [1/2]

SubProblem& SystemBase::subproblem ( )
inline

◆ subproblem() [2/2]

const SubProblem& SystemBase::subproblem ( ) const
inline

Definition at line 102 of file SystemBase.h.

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

◆ system() [1/2]

virtual libMesh::System& SystemBase::system ( )
pure virtual

Get the reference to the libMesh system.

Implemented in NonlinearSystemBase, DisplacedSystem, AuxiliarySystem, and LinearSystem.

Referenced by MooseVariableFieldBase::activeOnSubdomain(), MooseVariableFieldBase::activeSubdomains(), SubProblem::addCouplingGhostingFunctor(), addMatrix(), CreateDisplacedProblemAction::addProxyRelationshipManagers(), addVariable(), MultiAppConservativeTransfer::adjustTransferredSolution(), MultiAppConservativeTransfer::adjustTransferredSolutionNearestPoint(), augmentSendList(), MultiAppGeneralFieldNearestLocationTransfer::buildKDTrees(), MultiAppGeneralFieldShapeEvaluationTransfer::buildMeshFunctions(), SubProblem::cloneCouplingGhostingFunctor(), copySolutionsBackwards(), copyVars(), dofMap(), FEProblemBase::duplicateVariableCheck(), EigenProblem::EigenProblem(), PointwiseRenormalizeVector::execute(), MultiAppNearestNodeTransfer::execute(), MultiAppProjectionTransfer::execute(), MultiAppGeometricInterpolationTransfer::execute(), MultiAppUserObjectTransfer::execute(), FEProblem::FEProblem(), MultiAppGeometricInterpolationTransfer::fillSourceInterpolationPoints(), getVector(), Moose::globalDofIndexToDerivative(), hasScalarVariable(), hasVariable(), hasVector(), TimeIntegrator::init(), PointwiseRenormalizeVector::initialize(), MultiAppGeneralFieldNearestLocationTransfer::initialSetup(), MultiAppGeometricInterpolationTransfer::interpolateTargetPoints(), isArrayVariable(), isScalarVariable(), MassMatrix::MassMatrix(), MooseVariableBase::MooseVariableBase(), name(), number(), ConsoleUtils::outputSolverSystemInformation(), PointwiseRenormalizeVector::PointwiseRenormalizeVector(), prefix(), SolverSystem::preInit(), MultiAppProjectionTransfer::projectSolution(), reinitElem(), removeMatrix(), removeVector(), SolverSystem::restoreSolutions(), restoreSolutions(), serializedSolution(), SolverSystem::serializeSolution(), ElementSubdomainModifierBase::setOldAndOlderSolutions(), SolverSystem::solutionInternal(), solve(), MultiAppShapeEvaluationTransfer::transferVariable(), update(), and zeroVariables().

◆ system() [2/2]

virtual const libMesh::System& SystemBase::system ( ) const
pure virtual

◆ systemMatrixTag()

virtual TagID SystemBase::systemMatrixTag ( ) const
inlinevirtual

Return the Matrix Tag ID for System.

Reimplemented in NonlinearSystemBase, LinearSystem, and DisplacedSystem.

Definition at line 297 of file SystemBase.h.

Referenced by defaultMatrixTags(), and DisplacedSystem::systemMatrixTag().

297 { 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:333

◆ timestepSetup()

void SystemBase::timestepSetup ( )
virtual

Reimplemented in NonlinearSystemBase, and AuxiliarySystem.

Definition at line 1570 of file SystemBase.C.

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

1571 {
1572  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
1573  _vars[tid].timestepSetup();
1574 }
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:209
virtual void timestepSetup()
Definition: SystemBase.C:1570

◆ timeVectorTag()

virtual TagID SystemBase::timeVectorTag ( ) const
inlinevirtual

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

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

292 { 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:333

◆ update()

void SystemBase::update ( )

◆ varKind()

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

Definition at line 924 of file SystemBase.h.

Referenced by Coupleable::coupled().

924 { 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)

Zero vector with the given tag.

Definition at line 674 of file SystemBase.C.

Referenced by zeroTaggedVectors().

675 {
676  if (!_subproblem.vectorTagExists(tag))
677  mooseError("Cannot zero vector with TagID ",
678  tag,
679  " in system '",
680  name(),
681  "' because that tag does not exist in the problem");
682  else if (!hasVector(tag))
683  mooseError("Cannot zero vector tag with name '",
685  "' in system '",
686  name(),
687  "' because there is no vector associated with that tag");
689  getVector(tag).zero();
690 }
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:916
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
bool vectorTagNotZeroed(const TagID tag) const
Checks if a vector tag is in the list of vectors that will not be zeroed when other tagged vectors ar...
Definition: SubProblem.C:155
virtual void zero()=0
virtual const std::string & name() const
Definition: SystemBase.C:1332
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:221
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
Definition: SystemBase.C:925

◆ zeroTaggedVectors()

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

Zero all vectors for given tags.

Definition at line 693 of file SystemBase.C.

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

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

◆ zeroVariables()

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

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

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

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

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

236 {
238 }
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:200

◆ zeroVariablesForResidual()

void SystemBase::zeroVariablesForResidual ( )
virtual

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

230 {
232 }
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:200

Member Data Documentation

◆ _active_tagged_matrices

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

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 activateAllMatrixTags(), deactivateAllMatrixTags(), and reinitElem().

◆ _app

MooseApp& SystemBase::_app
protected

◆ _automatic_scaling

bool SystemBase::_automatic_scaling
protected

Whether to automatically scale the variables.

Definition at line 1055 of file SystemBase.h.

Referenced by 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(), 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(), LinearSystem::computeLinearSystemTags(), FEProblemBase::computeLinearSystemTags(), NonlinearSystemBase::computeScaling(), Problem::console(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MFEMSteady::execute(), MessageFromInput::execute(), SteadyBase::execute(), Eigenvalue::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), MeshGeneratorSystem::executeMeshGenerators(), ElementQualityChecker::finalize(), SidesetAroundSubdomainUpdater::finalize(), FEProblemBase::finishMultiAppStep(), MeshRepairGenerator::fixOverlappingNodes(), CoarsenBlockGenerator::generate(), MeshGenerator::generateInternal(), VariableCondensationPreconditioner::getDofToCondense(), InversePowerMethod::init(), NonlinearEigen::init(), FEProblemBase::initialAdaptMesh(), DefaultMultiAppFixedPointConvergence::initialize(), EigenExecutionerBase::inversePowerIteration(), FEProblemBase::joinAndFinalize(), TransientBase::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), FEProblemBase::logAdd(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseBase::mooseDeprecated(), 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(), 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(), NonlinearSystem::solve(), FixedPointSolve::solve(), LinearSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), LStableDirk4::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), PerfGraphLivePrint::start(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), MFEMTransient::takeStep(), TransientBase::takeStep(), TerminateChainControl::terminate(), Convergence::verboseOutput(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _du_dot_du

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

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 addVariable(), duDotDu(), and duDotDus().

◆ _du_dotdot_du

Real SystemBase::_du_dotdot_du
protected

Definition at line 1018 of file SystemBase.h.

Referenced by duDotDotDu().

◆ _factory

Factory& SystemBase::_factory
protected

◆ _fe_problem

FEProblemBase& SystemBase::_fe_problem
protected

the governing finite element/volume problem

Definition at line 986 of file SystemBase.h.

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

◆ _matrix_tag_active_flags

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

Active flags for tagged matrices.

Definition at line 1027 of file SystemBase.h.

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

◆ _max_var_n_dofs_per_elem

size_t SystemBase::_max_var_n_dofs_per_elem
protected

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

Definition at line 1043 of file SystemBase.h.

Referenced by assignMaxVarNDofsPerElem(), and getMaxVarNDofsPerElem().

◆ _max_var_n_dofs_per_node

size_t SystemBase::_max_var_n_dofs_per_node
protected

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

Definition at line 1046 of file SystemBase.h.

Referenced by assignMaxVarNDofsPerNode(), and getMaxVarNDofsPerNode().

◆ _max_var_number

unsigned int SystemBase::_max_var_number
protected

Maximum variable number.

Definition at line 1000 of file SystemBase.h.

Referenced by addVariable(), and getMaxVariableNumber().

◆ _mesh

MooseMesh& SystemBase::_mesh
protected

◆ _name

std::string SystemBase::_name
protected

The name of this system.

Definition at line 993 of file SystemBase.h.

◆ _numbered_vars

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

Map variable number to its pointer.

Definition at line 1052 of file SystemBase.h.

Referenced by addVariable(), and getVariable().

◆ _raw_grad_container

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

A cache for storing gradients at dof locations.

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

Definition at line 1073 of file SystemBase.h.

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

◆ _saved_dot_old

NumericVector<Real>* SystemBase::_saved_dot_old
protected

Definition at line 1034 of file SystemBase.h.

Referenced by restoreOldSolutions(), and saveOldSolutions().

◆ _saved_dotdot_old

NumericVector<Real>* SystemBase::_saved_dotdot_old
protected

Definition at line 1035 of file SystemBase.h.

Referenced by restoreOldSolutions(), and saveOldSolutions().

◆ _saved_old

NumericVector<Real>* SystemBase::_saved_old
protected

Definition at line 1030 of file SystemBase.h.

◆ _saved_older

NumericVector<Real>* SystemBase::_saved_older
protected

Definition at line 1031 of file SystemBase.h.

◆ _saved_solution_states

std::vector<NumericVector<Number> *> SystemBase::_saved_solution_states
private

The saved solution states (0 = current, 1 = old, 2 = older, etc)

Definition at line 1086 of file SystemBase.h.

Referenced by restoreOldSolutions(), and saveOldSolutions().

◆ _serialized_solution

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

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(), serializedSolution(), SolverSystem::serializeSolution(), AuxiliarySystem::serializeSolution(), and SolverSystem::setSolution().

◆ _solution_states

std::array<std::vector<NumericVector<Number> *>, 3> SystemBase::_solution_states
private

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 at line 1084 of file SystemBase.h.

Referenced by copyOldSolutions(), copyPreviousFixedPointSolutions(), copyPreviousNonlinearSolutions(), hasSolutionState(), needSolutionState(), restoreOldSolutions(), saveOldSolutions(), solutionState(), and solutionStateParallelType().

◆ _solution_states_initialized

bool SystemBase::_solution_states_initialized
protected

Whether or not the solution states have been initialized.

Definition at line 1061 of file SystemBase.h.

Referenced by initSolutionState(), and solutionStatesInitialized().

◆ _subproblem

SubProblem& SystemBase::_subproblem
protected

◆ _tagged_matrices

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

Tagged matrices (pointer)

Definition at line 1023 of file SystemBase.h.

Referenced by associateMatrixToTag(), disassociateMatrixFromTag(), getMatrix(), hasMatrix(), and removeMatrix().

◆ _tagged_vectors

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

Tagged vectors (pointer)

Definition at line 1021 of file SystemBase.h.

Referenced by associateVectorToTag(), disassociateVectorFromTag(), getVector(), hasVector(), and removeVector().

◆ _time_integrators

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

◆ _u_dot

NumericVector<Number>* SystemBase::_u_dot
protected

solution vector for u^dot

Definition at line 1006 of file SystemBase.h.

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

◆ _u_dot_old

NumericVector<Number>* SystemBase::_u_dot_old
protected

old solution vector for u^dot

Definition at line 1011 of file SystemBase.h.

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

◆ _u_dotdot

NumericVector<Number>* SystemBase::_u_dotdot
protected

solution vector for u^dotdot

Definition at line 1008 of file SystemBase.h.

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

◆ _u_dotdot_old

NumericVector<Number>* SystemBase::_u_dotdot_old
protected

old solution vector for u^dotdot

Definition at line 1013 of file SystemBase.h.

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

◆ _var_all_dof_indices

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

Container for the dof indices of a given variable.

Definition at line 1064 of file SystemBase.h.

Referenced by getVariableGlobalDoFs(), and setVariableGlobalDoFs().

◆ _var_kind

Moose::VarKindType SystemBase::_var_kind
protected

default kind of variables in this system

Definition at line 1038 of file SystemBase.h.

Referenced by varKind().

◆ _var_map

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

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

Definition at line 998 of file SystemBase.h.

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

◆ _var_to_copy

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

Definition at line 1040 of file SystemBase.h.

Referenced by addVariableToCopy(), copyVars(), and hasVarCopy().

◆ _vars

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

◆ _vars_to_be_zeroed_on_jacobian

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

Definition at line 1003 of file SystemBase.h.

Referenced by addVariableToZeroOnJacobian(), and zeroVariablesForJacobian().

◆ _vars_to_be_zeroed_on_residual

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

Definition at line 1002 of file SystemBase.h.

Referenced by addVariableToZeroOnResidual(), and zeroVariablesForResidual().

◆ _verbose

bool SystemBase::_verbose
protected

True if printing out additional information.

Definition at line 1058 of file SystemBase.h.

Referenced by applyScalingFactors(), and setVerboseFlag().


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