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

#include <DisplacedSystem.h>

Inheritance diagram for DisplacedSystem:
[legend]

Public Member Functions

 DisplacedSystem (DisplacedProblem &problem, SystemBase &undisplaced_system, const std::string &name, Moose::VarKindType var_kind)
 
virtual ~DisplacedSystem ()
 
virtual void init () override
 Initialize the system. More...
 
virtual NumericVector< Number > & getVector (TagID tag_id) override
 Get a raw NumericVector. More...
 
virtual const NumericVector< Number > & getVector (TagID tag_id) const override
 Get a raw NumericVector. More...
 
virtual TagID residualVectorTag () override
 
virtual TagID systemMatrixTag () override
 Return the Matrix Tag ID for System. More...
 
virtual TagID timeVectorTag () override
 Ideally, we should not need this API. More...
 
virtual TagID nonTimeVectorTag () override
 
virtual void associateVectorToTag (NumericVector< Number > &vec, TagID tag) override
 Associate a vector for a given tag. More...
 
virtual void disassociateVectorFromTag (NumericVector< Number > &vec, TagID tag) override
 Associate a vector for a given tag. More...
 
virtual void disassociateAllTaggedVectors () override
 Disassociate all vectors, and then hasVector() will return false. More...
 
virtual void associateMatrixToTag (SparseMatrix< Number > &matrix, TagID tag) override
 associate a matirx to a tag More...
 
virtual void disassociateMatrixFromTag (SparseMatrix< Number > &matrix, TagID tag) override
 disassociate a matirx from a tag More...
 
virtual void disassociateAllTaggedMatrices () override
 Clear all tagged matrices. More...
 
virtual NumericVector< Number > & getVector (const std::string &name) override
 Get a raw NumericVector. More...
 
virtual NumericVector< Number > & serializedSolution () override
 Returns a reference to a serialized version of the solution vector for this subproblem. More...
 
const NumericVector< Number > *const & currentSolution () const override
 The solution vector that is currently being operated on. More...
 
NumericVector< Number > & solution () override
 
NumericVector< Number > & solutionOld () override
 
NumericVector< Number > & solutionOlder () override
 
NumericVector< Number > * solutionPreviousNewton () override
 
const NumericVector< Number > & solution () const override
 
const NumericVector< Number > & solutionOld () const override
 
const NumericVector< Number > & solutionOlder () const override
 
const NumericVector< Number > * solutionPreviousNewton () const override
 
NumericVector< Number > * solutionUDot () override
 
NumericVector< Number > * solutionUDotDot () override
 
NumericVector< Number > * solutionUDotOld () override
 
NumericVector< Number > * solutionUDotDotOld () override
 
const NumericVector< Number > * solutionUDot () const override
 
const NumericVector< Number > * solutionUDotDot () const override
 
const NumericVector< Number > * solutionUDotOld () const override
 
const NumericVector< Number > * solutionUDotDotOld () const override
 
virtual Number & duDotDu () override
 
virtual Number & duDotDotDu () override
 
virtual const Number & duDotDu () const override
 
virtual const Number & duDotDotDu () const override
 
virtual NumericVector< Number > & residualCopy () override
 Return the residual copy from the NonlinearSystem. More...
 
virtual NumericVector< Number > & residualGhosted () override
 
virtual void augmentSendList (std::vector< dof_id_type > &send_list) override
 Will modify the send_list to add all of the extra ghosted dofs for this system. More...
 
virtual void augmentSparsity (SparsityPattern::Graph &, std::vector< dof_id_type > &, std::vector< dof_id_type > &) override
 This is an empty function since the displaced system doesn't have a matrix! All sparsity pattern modification will be taken care of by the undisplaced system directly. More...
 
virtual void addVariableToZeroOnResidual (std::string var_name) override
 Adds this variable to the list of variables to be zeroed during each residual evaluation. More...
 
virtual void addVariableToZeroOnJacobian (std::string var_name) override
 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) override
 Zero out the solution for the list of variables passed in. More...
 
virtual bool hasVector (TagID tag_id) const override
 Check if the tagged vector exists in the system. More...
 
virtual bool hasMatrix (TagID tag_id) const override
 Check if the tagged matrix exists in the system. More...
 
virtual SparseMatrix< Number > & getMatrix (TagID tag) override
 Get a raw SparseMatrix. More...
 
virtual const SparseMatrix< Number > & getMatrix (TagID tag) const override
 Get a raw SparseMatrix. More...
 
virtual TransientExplicitSystem & sys ()
 
virtual System & system () override
 Get the reference to the libMesh system. More...
 
virtual const System & system () const override
 
void addTimeIntegrator (std::shared_ptr< TimeIntegrator > ti) override
 
virtual void addTimeIntegrator (const std::string &, const std::string &, InputParameters &)
 
virtual void addTimeIntegrator (std::shared_ptr< TimeIntegrator >)
 
virtual unsigned int number () const
 Gets the number of this system. More...
 
virtual MooseMeshmesh ()
 
virtual const MooseMeshmesh () const
 
virtual SubProblemsubproblem ()
 
virtual const SubProblemsubproblem () const
 
void applyScalingFactors (const std::vector< Real > &inverse_scaling_factors)
 Applies scaling factors to the system's variables. More...
 
bool computingScalingJacobian () const
 Whether we are computing an initial Jacobian for automatic variable scaling. More...
 
void computingScalingJacobian (bool computing_scaling_jacobian)
 Setter for whether we're computing the scaling jacobian. More...
 
bool computingScalingResidual () const
 Whether we are computing an initial Residual for automatic variable scaling. More...
 
void computingScalingResidual (bool computing_scaling_residual)
 Setter for whether we're computing the scaling residual. More...
 
virtual DofMap & dofMap ()
 Gets writeable reference to the dof map. More...
 
virtual const DofMap & dofMap () const
 Gets const reference to the dof map. More...
 
virtual void initializeObjects ()
 Called only once, just before the solve begins so objects can do some precalculations. More...
 
virtual void addExtraVectors ()
 Method called during initialSetup to add extra system vector if they are required by the simulation. More...
 
virtual 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 restoreSolutions ()
 Restore current solutions (call after your solve failed) More...
 
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 TagID timeMatrixTag ()
 Return the Matrix Tag ID for Time. More...
 
virtual void activeAllMatrixTags ()
 Make all exsiting matrices ative. More...
 
virtual void activeMatrixTag (TagID tag)
 Active a matrix for tag. More...
 
virtual bool matrixTagActive (TagID tag) const
 If or not a matrix tag is active. More...
 
virtual void deactiveMatrixTag (TagID tag)
 deactive a matrix for tag More...
 
virtual void deactiveAllMatrixTags ()
 Make matrices inactive. More...
 
void closeTaggedMatrices (const std::set< TagID > &tags)
 Close all matrices associated the tags. More...
 
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
 
MooseVariableFEBasegetVariable (THREAD_ID tid, const std::string &var_name)
 Gets a reference to a variable of with specified name. More...
 
MooseVariableFEBasegetVariable (THREAD_ID tid, unsigned int var_number)
 Gets a reference to a variable with specified number. More...
 
template<typename T >
MooseVariableFE< T > & getFieldVariable (THREAD_ID tid, const std::string &var_name)
 Gets a reference to a variable of with specified name. More...
 
template<typename T >
MooseVariableFE< T > & getFieldVariable (THREAD_ID tid, unsigned int var_number)
 Gets a reference to a variable with specified number. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, const std::string &var_name)
 Gets a reference to a scalar variable with specified number. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, unsigned int var_number)
 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...
 
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 zeroVariablesForResidual ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on residual evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual void zeroVariablesForJacobian ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on Jacobian evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual Order getMinQuadratureOrder ()
 Get minimal quadrature order needed for integrating variables in this system. More...
 
virtual void prepare (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareFace (THREAD_ID tid, bool resize_data)
 Prepare the system for use on sides. More...
 
virtual void prepareNeighbor (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareLowerD (THREAD_ID tid)
 Prepare the system for use for lower dimensional elements. More...
 
virtual void reinitElem (const Elem *elem, THREAD_ID tid)
 Reinit an element assembly info. More...
 
virtual void reinitElemFace (const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid)
 Reinit assembly info for a side of an element. More...
 
virtual void reinitNeighborFace (const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitNeighbor (const Elem *elem, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitLowerD (THREAD_ID tid)
 Compute the values of the variables on the lower dimensional element. More...
 
virtual void reinitNode (const Node *node, THREAD_ID tid)
 Reinit nodal assembly info. More...
 
virtual void 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< MooseVariableFEBase * > & getVariables (THREAD_ID tid)
 
const std::vector< MooseVariableScalar * > & getScalarVariables (THREAD_ID tid)
 
const std::set< SubdomainID > & getSubdomainsForVar (unsigned int var_number) const
 
virtual void removeVector (const std::string &name)
 Remove a vector from the system with the given name. More...
 
virtual void removeVector (TagID tag_id)
 Remove a solution length vector from the system with the specified TagID. More...
 
virtual NumericVector< Number > & addVector (const std::string &vector_name, const bool project, const ParallelType type)
 Adds a solution length vector to the system. More...
 
NumericVector< Number > & addVector (TagID tag, const bool project, const ParallelType type)
 Adds a solution length vector to the system with the specified TagID. More...
 
virtual void closeTaggedVectors (const std::set< TagID > &tags)
 Close all vectors for given tags. More...
 
virtual void zeroTaggedVectors (const std::set< TagID > &tags)
 Zero all vectors for given tags. More...
 
virtual SparseMatrix< Number > & addMatrix (TagID)
 Adds a jacobian sized vector. More...
 
virtual void removeMatrix (TagID)
 Removes a jacobian sized vector. More...
 
virtual const std::string & name () const
 
const std::vector< VariableName > & getVariableNames () const
 
unsigned int getMaxVariableNumber () const
 Returns the maximum number of all variables on the system. More...
 
virtual void computeVariables (const NumericVector< Number > &)
 
void copyVars (ExodusII_IO &io)
 
virtual void copySolutionsBackwards ()
 Copy current solution into old and older. More...
 
virtual void addTimeIntegrator (const std::string &, const std::string &, InputParameters &)
 
TimeIntegratorgetTimeIntegrator ()
 
const TimeIntegratorgetTimeIntegrator () const
 
std::shared_ptr< TimeIntegratorgetSharedTimeIntegrator ()
 
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
 

Protected Attributes

SystemBase_undisplaced_system
 
TransientExplicitSystem & _sys
 
SubProblem_subproblem
 
MooseApp_app
 
Factory_factory
 
MooseMesh_mesh
 
std::string _name
 The name of this system. More...
 
std::vector< VariableWarehouse_vars
 Variable warehouses (one for each thread) More...
 
std::map< unsigned int, std::set< SubdomainID > > _var_map
 Map of variables (variable id -> array of subdomains where it lives) More...
 
unsigned int _max_var_number
 Maximum variable number. More...
 
std::vector< std::string > _vars_to_be_zeroed_on_residual
 
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
 
Real _du_dot_du
 
Real _du_dotdot_du
 
std::vector< NumericVector< Number > * > _tagged_vectors
 Tagged vectors (pointer) More...
 
std::vector< SparseMatrix< Number > * > _tagged_matrices
 Tagged matrices (pointer) More...
 
std::vector< bool > _matrix_tag_active_flags
 Active flags for tagged matrices. More...
 
NumericVector< Real > * _saved_old
 
NumericVector< Real > * _saved_older
 
NumericVector< Real > * _saved_dot_old
 
NumericVector< Real > * _saved_dotdot_old
 
Moose::VarKindType _var_kind
 default kind of variables in this system More...
 
std::vector< VarCopyInfo_var_to_copy
 
size_t _max_var_n_dofs_per_elem
 Maximum number of dofs for any one variable on any one element. More...
 
size_t _max_var_n_dofs_per_node
 Maximum number of dofs for any one variable on any one node. More...
 
std::shared_ptr< TimeIntegrator_time_integrator
 Time integrator. More...
 
std::vector< std::vector< MooseVariableFEBase * > > _numbered_vars
 Map variable number to its pointer. More...
 
MooseObjectWarehouseBase< MooseVariableBase_variable_warehouse
 Storage for MooseVariable objects. More...
 
bool _computing_scaling_jacobian
 Flag used to indicate whether we are computing the scaling Jacobian. More...
 
bool _computing_scaling_residual
 Flag used to indicate whether we are computing the scaling Residual. More...
 

Detailed Description

Definition at line 24 of file DisplacedSystem.h.

Constructor & Destructor Documentation

◆ DisplacedSystem()

DisplacedSystem::DisplacedSystem ( DisplacedProblem problem,
SystemBase undisplaced_system,
const std::string &  name,
Moose::VarKindType  var_kind 
)

Definition at line 18 of file DisplacedSystem.C.

22  : SystemBase(problem, name, var_kind),
23  _undisplaced_system(undisplaced_system),
24  _sys(problem.es().add_system<TransientExplicitSystem>(name))
25 {
26  if (!problem.defaultGhosting())
27  {
28  auto & dof_map = _sys.get_dof_map();
29  dof_map.remove_algebraic_ghosting_functor(dof_map.default_algebraic_ghosting());
30  dof_map.set_implicit_neighbor_dofs(false);
31  }
32 }

◆ ~DisplacedSystem()

DisplacedSystem::~DisplacedSystem ( )
virtual

Definition at line 34 of file DisplacedSystem.C.

34 {}

Member Function Documentation

◆ activeAllMatrixTags()

void SystemBase::activeAllMatrixTags ( )
virtualinherited

Make all exsiting matrices ative.

Definition at line 944 of file SystemBase.C.

945 {
946  auto num_matrix_tags = _subproblem.numMatrixTags();
947 
948  _matrix_tag_active_flags.resize(num_matrix_tags);
949 
950  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
951  if (hasMatrix(tag))
952  _matrix_tag_active_flags[tag] = true;
953  else
954  _matrix_tag_active_flags[tag] = false;
955 }

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

◆ activeMatrixTag()

void SystemBase::activeMatrixTag ( TagID  tag)
virtualinherited

Active a matrix for tag.

Definition at line 909 of file SystemBase.C.

910 {
911  mooseAssert(_subproblem.matrixTagExists(tag),
912  "Cannot active Matrix with matrix_tag : " << tag << "that does not exist");
913 
914  if (_matrix_tag_active_flags.size() < tag + 1)
915  _matrix_tag_active_flags.resize(tag + 1);
916 
917  _matrix_tag_active_flags[tag] = true;
918 }

◆ addExtraVectors()

void SystemBase::addExtraVectors ( )
virtualinherited

Method called during initialSetup to add extra system vector if they are required by the simulation.

Reimplemented in NonlinearSystemBase, and AuxiliarySystem.

Definition at line 1062 of file SystemBase.C.

1063 {
1064 }

◆ addMatrix()

virtual SparseMatrix<Number>& SystemBase::addMatrix ( TagID  )
inlinevirtualinherited

Adds a jacobian sized vector.

Parameters
tag_nameThe name of the tag

Reimplemented in NonlinearSystem.

Definition at line 722 of file SystemBase.h.

723  {
724  mooseError("Adding a matrix is not supported for this type of system!");
725  }

◆ addTimeIntegrator() [1/4]

virtual void SystemBase::addTimeIntegrator
inline

Definition at line 755 of file SystemBase.h.

758  {
759  }

◆ addTimeIntegrator() [2/4]

virtual void SystemBase::addTimeIntegrator ( const std::string &  ,
const std::string &  ,
InputParameters  
)
inlinevirtualinherited

Reimplemented in NonlinearSystemBase, and AuxiliarySystem.

Definition at line 755 of file SystemBase.h.

758  {
759  }

◆ addTimeIntegrator() [3/4]

void DisplacedSystem::addTimeIntegrator ( std::shared_ptr< TimeIntegrator ti)
overridevirtual

Reimplemented from SystemBase.

Definition at line 51 of file DisplacedSystem.C.

52 {
53  _time_integrator = ti;
54 }

Referenced by DisplacedProblem::DisplacedProblem().

◆ addTimeIntegrator() [4/4]

virtual void SystemBase::addTimeIntegrator
inline

Definition at line 761 of file SystemBase.h.

761 {}

◆ addVariable()

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

Canonical method for adding a variable.

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

Reimplemented in AuxiliarySystem.

Definition at line 614 of file SystemBase.C.

617 {
618  _numbered_vars.resize(libMesh::n_threads());
619 
620  auto components = parameters.get<unsigned int>("components");
621 
622  // Convert the std::vector parameter provided by the user into a std::set for use by libMesh's
623  // System::add_variable method
624  std::set<SubdomainID> blocks;
625  const auto & block_param = parameters.get<std::vector<SubdomainName>>("block");
626  for (const auto & subdomain_name : block_param)
627  {
628  SubdomainID blk_id = _mesh.getSubdomainID(subdomain_name);
629  blocks.insert(blk_id);
630  }
631 
632  auto fe_type = FEType(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")),
633  Utility::string_to_enum<FEFamily>(parameters.get<MooseEnum>("family")));
634 
635  unsigned int var_num;
636 
637  if (var_type == "ArrayMooseVariable")
638  {
639  if (fe_type.family == NEDELEC_ONE || fe_type.family == LAGRANGE_VEC ||
640  fe_type.family == MONOMIAL_VEC)
641  mooseError("Vector family type cannot be used in an array variable");
642 
643  // Turn off automatic variable group identification so that we can be sure that this variable
644  // group will be ordered exactly like it should be
645  system().identify_variable_groups(false);
646 
647  // Build up the variable names
648  std::vector<std::string> var_names;
649  for (unsigned int i = 0; i < components; i++)
650  var_names.push_back(SubProblem::arrayVariableComponent(name, i));
651 
652  // The number returned by libMesh is the _last_ variable number... we want to hold onto the
653  // _first_
654  var_num = system().add_variables(var_names, fe_type, &blocks) - (components - 1);
655  }
656  else
657  var_num = system().add_variable(name, fe_type, &blocks);
658 
659  parameters.set<unsigned int>("_var_num") = var_num;
660  parameters.set<SystemBase *>("_system_base") = this;
661 
662  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
663  {
664  parameters.set<THREAD_ID>("tid") = tid;
665  std::shared_ptr<MooseVariableBase> var =
666  _factory.create<MooseVariableBase>(var_type, name, parameters, tid);
667 
668  _vars[tid].add(name, var);
669 
670  if (auto fe_var = dynamic_cast<MooseVariableFEBase *>(var.get()))
671  {
672  auto required_size = var_num + components;
673  if (required_size > _numbered_vars[tid].size())
674  _numbered_vars[tid].resize(required_size);
675  for (MooseIndex(components) component = 0; component < components; ++component)
676  _numbered_vars[tid][var_num + component] = fe_var;
677  }
678 
679  if (var->blockRestricted())
680  for (const SubdomainID & id : var->blockIDs())
681  for (MooseIndex(components) component = 0; component < components; ++component)
682  _var_map[var_num + component].insert(id);
683  else
684  for (MooseIndex(components) component = 0; component < components; ++component)
685  _var_map[var_num + component] = std::set<SubdomainID>();
686  }
687 
688  // getMaxVariableNumber is an API method used in Rattlesnake
689  if (var_num > _max_var_number)
690  _max_var_number = var_num;
691 }

Referenced by DisplacedProblem::addAuxVariable(), AuxiliarySystem::addVariable(), and DisplacedProblem::addVariable().

◆ addVariableToCopy()

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

Add info about variable that will be copied.

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

Definition at line 991 of file SystemBase.C.

994 {
995  _var_to_copy.push_back(VarCopyInfo(dest_name, source_name, timestep));
996 }

◆ addVariableToZeroOnJacobian()

virtual void DisplacedSystem::addVariableToZeroOnJacobian ( std::string  var_name)
inlineoverridevirtual

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

Definition at line 180 of file DisplacedSystem.h.

181  {
183  }

◆ addVariableToZeroOnResidual()

virtual void DisplacedSystem::addVariableToZeroOnResidual ( std::string  var_name)
inlineoverridevirtual

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

Definition at line 171 of file DisplacedSystem.h.

172  {
174  }

◆ addVector() [1/2]

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

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.

Reimplemented in AuxiliarySystem.

Definition at line 543 of file SystemBase.C.

544 {
545  if (hasVector(vector_name))
546  return getVector(vector_name);
547 
548  NumericVector<Number> & vec = system().add_vector(vector_name, project, type);
549  return vec;
550 }

Referenced by NonlinearSystemBase::addDotVectors(), NonlinearSystemBase::addExtraVectors(), AStableDirk4::AStableDirk4(), MultiApp::createApp(), ExplicitTimeIntegrator::ExplicitTimeIntegrator(), NonlinearSystemBase::getResidualNonTimeVector(), NonlinearSystemBase::getResidualTimeVector(), FEProblemBase::initNullSpaceVectors(), LStableDirk3::LStableDirk3(), LStableDirk4::LStableDirk4(), PicardSolve::PicardSolve(), NonlinearSystemBase::residualGhosted(), and SystemBase::saveOldSolutions().

◆ addVector() [2/2]

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

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

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

Definition at line 553 of file SystemBase.C.

554 {
555  if (!_subproblem.vectorTagExists(tag))
556  mooseError("Cannot add a tagged vector with vector_tag, ",
557  tag,
558  ", that tag does not exist in System ",
559  name());
560 
561  if (hasVector(tag))
562  return getVector(tag);
563 
564  auto vector_name = _subproblem.vectorTagName(tag);
565 
566  NumericVector<Number> & vec = system().add_vector(vector_name, project, type);
567 
568  if (_tagged_vectors.size() < tag + 1)
569  _tagged_vectors.resize(tag + 1);
570 
571  _tagged_vectors[tag] = &vec;
572 
573  return vec;
574 }

◆ applyScalingFactors()

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

Applies scaling factors to the system's variables.

Parameters
inverse_scaling_factorsA vector containing the inverse of each variable's scaling factor, e.g. 1 / scaling_factor

Definition at line 1141 of file SystemBase.C.

1142 {
1143  for (MooseIndex(_vars) thread = 0; thread < _vars.size(); ++thread)
1144  {
1145  auto & field_variables = _vars[thread].fieldVariables();
1146  for (MooseIndex(field_variables) i = 0; i < field_variables.size(); ++i)
1147  field_variables[i]->scalingFactor(1. / inverse_scaling_factors[i] *
1148  field_variables[i]->scalingFactor());
1149 
1150  auto offset = field_variables.size();
1151 
1152  auto & scalar_variables = _vars[thread].scalars();
1153  for (MooseIndex(scalar_variables) i = 0; i < scalar_variables.size(); ++i)
1154  scalar_variables[i]->scalingFactor(1. / inverse_scaling_factors[offset + i] *
1155  scalar_variables[i]->scalingFactor());
1156  }
1157 }

Referenced by NonlinearSystem::computeScaling().

◆ assignMaxVarNDofsPerElem()

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

assign the maximum element dofs

Definition at line 492 of file SystemBase.h.

492 { _max_var_n_dofs_per_elem = max_dofs; }

◆ assignMaxVarNDofsPerNode()

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

assign the maximum node dofs

Definition at line 497 of file SystemBase.h.

497 { _max_var_n_dofs_per_node = max_dofs; }

◆ associateMatrixToTag()

virtual void DisplacedSystem::associateMatrixToTag ( SparseMatrix< Number > &  matrix,
TagID  tag 
)
inlineoverridevirtual

associate a matirx to a tag

Reimplemented from SystemBase.

Definition at line 67 of file DisplacedSystem.h.

68  {
70  }

◆ associateVectorToTag()

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

Associate a vector for a given tag.

Reimplemented from SystemBase.

Definition at line 52 of file DisplacedSystem.h.

53  {
55  }

◆ augmentSendList()

virtual void DisplacedSystem::augmentSendList ( std::vector< dof_id_type > &  send_list)
inlineoverridevirtual

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

Reimplemented from SystemBase.

Definition at line 152 of file DisplacedSystem.h.

153  {
155  }

◆ augmentSparsity()

virtual void DisplacedSystem::augmentSparsity ( SparsityPattern::Graph &  ,
std::vector< dof_id_type > &  ,
std::vector< dof_id_type > &   
)
inlineoverridevirtual

This is an empty function since the displaced system doesn't have a matrix! All sparsity pattern modification will be taken care of by the undisplaced system directly.

Implements SystemBase.

Definition at line 161 of file DisplacedSystem.h.

164  {
165  }

◆ closeTaggedMatrices()

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

Close all matrices associated the tags.

Definition at line 874 of file SystemBase.C.

875 {
876  for (auto tag : tags)
877  if (hasMatrix(tag))
878  getMatrix(tag).close();
879 }

Referenced by NonlinearSystemBase::computeJacobianInternal().

◆ closeTaggedVectors()

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

Close all vectors for given tags.

Definition at line 577 of file SystemBase.C.

578 {
579  for (auto & tag : tags)
580  {
581  mooseAssert(_subproblem.vectorTagExists(tag), "Tag: " << tag << " does not exsit");
582  getVector(tag).close();
583  }
584 }

Referenced by NonlinearSystemBase::computeResidualTags().

◆ computeVariables()

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

Definition at line 746 of file SystemBase.h.

746 {}

◆ computingScalingJacobian() [1/2]

bool SystemBase::computingScalingJacobian ( ) const
inlineinherited

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

Definition at line 121 of file SystemBase.h.

121 { return _computing_scaling_jacobian; }

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

◆ computingScalingJacobian() [2/2]

void SystemBase::computingScalingJacobian ( bool  computing_scaling_jacobian)
inlineinherited

Setter for whether we're computing the scaling jacobian.

Definition at line 126 of file SystemBase.h.

127  {
128  _computing_scaling_jacobian = computing_scaling_jacobian;
129  }

◆ computingScalingResidual() [1/2]

bool SystemBase::computingScalingResidual ( ) const
inlineinherited

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

Definition at line 134 of file SystemBase.h.

134 { return _computing_scaling_residual; }

◆ computingScalingResidual() [2/2]

void SystemBase::computingScalingResidual ( bool  computing_scaling_residual)
inlineinherited

Setter for whether we're computing the scaling residual.

Definition at line 139 of file SystemBase.h.

140  {
141  _computing_scaling_residual = computing_scaling_residual;
142  }

◆ copyOldSolutions()

void SystemBase::copyOldSolutions ( )
virtualinherited

Shifts the solutions backwards in time.

Definition at line 1099 of file SystemBase.C.

1100 {
1101  solutionOlder() = solutionOld();
1103  if (solutionUDotOld())
1104  *solutionUDotOld() = *solutionUDot();
1105  if (solutionUDotDotOld())
1107  if (solutionPreviousNewton())
1109 }

Referenced by EigenExecutionerBase::inversePowerIteration().

◆ copySolutionsBackwards()

void SystemBase::copySolutionsBackwards ( )
virtualinherited

Copy current solution into old and older.

Definition at line 1082 of file SystemBase.C.

1083 {
1084  system().update();
1087  if (solutionUDotOld())
1088  *solutionUDotOld() = *solutionUDot();
1089  if (solutionUDotDotOld())
1091  if (solutionPreviousNewton())
1093 }

◆ copyVars()

void SystemBase::copyVars ( ExodusII_IO &  io)
inherited

Definition at line 999 of file SystemBase.C.

1000 {
1001  int n_steps = io.get_num_time_steps();
1002 
1003  bool did_copy = false;
1004  for (const auto & vci : _var_to_copy)
1005  {
1006  int timestep = -1;
1007 
1008  if (vci._timestep == "LATEST")
1009  // Use the last time step in the file from which to retrieve the solution
1010  timestep = n_steps;
1011  else
1012  {
1013  timestep = MooseUtils::convert<int>(vci._timestep);
1014  if (timestep > n_steps)
1015  mooseError("Invalid value passed as \"initial_from_file_timestep\". Expected \"LATEST\" or "
1016  "a valid integer between 1 and ",
1017  n_steps,
1018  " inclusive, received ",
1019  vci._timestep);
1020  }
1021 
1022  did_copy = true;
1023 
1024  if (hasVariable(vci._dest_name))
1025  {
1026  if (getVariable(0, vci._dest_name).isNodal())
1027  io.copy_nodal_solution(system(), vci._dest_name, vci._source_name, timestep);
1028 
1029  else
1030  io.copy_elemental_solution(system(), vci._dest_name, vci._source_name, timestep);
1031  }
1032  else if (hasScalarVariable(vci._dest_name))
1033  {
1034  auto rank = comm().rank();
1035  auto size = comm().size();
1036 
1037  // Read solution on rank 0 only and send data to rank "size - 1" where scalar DOFs are
1038  // stored
1039  std::vector<Real> global_values;
1040  if (rank == 0)
1041  {
1042  // Read the scalar value then set that value in the current solution
1043  io.read_global_variable({vci._source_name}, timestep, global_values);
1044  if (size > 1)
1045  comm().send(size - 1, global_values);
1046  }
1047  if (rank == size - 1)
1048  {
1049  if (size > 1)
1050  comm().receive(0, global_values);
1051  const unsigned int var_num = system().variable_number(vci._dest_name);
1052  system().solution->set(var_num, global_values[0]);
1053  }
1054  }
1055  }
1056 
1057  if (did_copy)
1058  solution().close();
1059 }

◆ currentSolution()

const NumericVector<Number>* const & DisplacedSystem::currentSolution ( ) const
inlineoverridevirtual

The solution vector that is currently being operated on.

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

Implements SystemBase.

Definition at line 89 of file DisplacedSystem.h.

90  {
92  }

◆ deactiveAllMatrixTags()

void SystemBase::deactiveAllMatrixTags ( )
virtualinherited

Make matrices inactive.

Definition at line 933 of file SystemBase.C.

934 {
935  auto num_matrix_tags = _subproblem.numMatrixTags();
936 
937  _matrix_tag_active_flags.resize(num_matrix_tags);
938 
939  for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
940  _matrix_tag_active_flags[tag] = false;
941 }

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

◆ deactiveMatrixTag()

void SystemBase::deactiveMatrixTag ( TagID  tag)
virtualinherited

deactive a matrix for tag

Definition at line 921 of file SystemBase.C.

922 {
923  mooseAssert(_subproblem.matrixTagExists(tag),
924  "Cannot deactivate Matrix with matrix_tag : " << tag << "that does not exist");
925 
926  if (_matrix_tag_active_flags.size() < tag + 1)
927  _matrix_tag_active_flags.resize(tag + 1);
928 
929  _matrix_tag_active_flags[tag] = false;
930 }

◆ disassociateAllTaggedMatrices()

virtual void DisplacedSystem::disassociateAllTaggedMatrices ( )
inlineoverridevirtual

Clear all tagged matrices.

Reimplemented from SystemBase.

Definition at line 77 of file DisplacedSystem.h.

◆ disassociateAllTaggedVectors()

virtual void DisplacedSystem::disassociateAllTaggedVectors ( )
inlineoverridevirtual

Disassociate all vectors, and then hasVector() will return false.

Reimplemented from SystemBase.

Definition at line 62 of file DisplacedSystem.h.

◆ disassociateMatrixFromTag()

virtual void DisplacedSystem::disassociateMatrixFromTag ( SparseMatrix< Number > &  matrix,
TagID  tag 
)
inlineoverridevirtual

disassociate a matirx from a tag

Reimplemented from SystemBase.

Definition at line 72 of file DisplacedSystem.h.

73  {
75  }

◆ disassociateVectorFromTag()

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

Associate a vector for a given tag.

Reimplemented from SystemBase.

Definition at line 57 of file DisplacedSystem.h.

58  {
60  }

◆ dofMap() [1/2]

DofMap & SystemBase::dofMap ( )
virtualinherited

◆ dofMap() [2/2]

const DofMap & SystemBase::dofMap ( ) const
virtualinherited

Gets const reference to the dof map.

Definition at line 985 of file SystemBase.C.

986 {
987  return system().get_dof_map();
988 }

◆ duDotDotDu() [1/2]

virtual const Number& DisplacedSystem::duDotDotDu ( ) const
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 137 of file DisplacedSystem.h.

137 { return _undisplaced_system.duDotDotDu(); }

◆ duDotDotDu() [2/2]

virtual Number& DisplacedSystem::duDotDotDu ( )
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 135 of file DisplacedSystem.h.

135 { return _undisplaced_system.duDotDotDu(); }

◆ duDotDu() [1/2]

virtual const Number& DisplacedSystem::duDotDu ( ) const
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 136 of file DisplacedSystem.h.

136 { return _undisplaced_system.duDotDu(); }

◆ duDotDu() [2/2]

virtual Number& DisplacedSystem::duDotDu ( )
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 134 of file DisplacedSystem.h.

134 { return _undisplaced_system.duDotDu(); }

◆ getFieldVariable() [1/2]

template<typename T >
MooseVariableFE< T > & SystemBase::getFieldVariable ( THREAD_ID  tid,
const std::string &  var_name 
)
inherited

Gets a reference to a variable of with specified name.

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

Definition at line 129 of file SystemBase.C.

130 {
131  return *_vars[tid].getFieldVariable<T>(var_name);
132 }

Referenced by Assembly::copyFaceShapes(), Assembly::copyNeighborShapes(), Assembly::copyShapes(), DisplacedProblem::getArrayVariable(), Marker::getMarkerValue(), DisplacedProblem::getStandardVariable(), and DisplacedProblem::getVectorVariable().

◆ getFieldVariable() [2/2]

template<typename T >
MooseVariableFE< T > & SystemBase::getFieldVariable ( THREAD_ID  tid,
unsigned int  var_number 
)
inherited

Gets a reference to a variable with specified number.

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

Definition at line 136 of file SystemBase.C.

137 {
138  return *_vars[tid].getFieldVariable<T>(var_number);
139 }

◆ getMatrix() [1/2]

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

Get a raw SparseMatrix.

Reimplemented from SystemBase.

Definition at line 207 of file DisplacedSystem.h.

208  {
209  return _undisplaced_system.getMatrix(tag);
210  }

◆ getMatrix() [2/2]

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

Get a raw SparseMatrix.

Reimplemented from SystemBase.

Definition at line 203 of file DisplacedSystem.h.

204  {
205  return _undisplaced_system.getMatrix(tag);
206  }

◆ getMaxVariableNumber()

unsigned int SystemBase::getMaxVariableNumber ( ) const
inlineinherited

Returns the maximum number of all variables on the system.

Definition at line 744 of file SystemBase.h.

744 { return _max_var_number; }

◆ getMaxVarNDofsPerElem()

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

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

Returns
The max

Definition at line 480 of file SystemBase.h.

480 { return _max_var_n_dofs_per_elem; }

Referenced by MooseVariableScalar::computeAD(), Assembly::computeAffineMapAD(), Assembly::computeFaceMap(), and Assembly::computeSinglePointMapAD().

◆ getMaxVarNDofsPerNode()

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

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

Returns
The max

Definition at line 487 of file SystemBase.h.

487 { return _max_var_n_dofs_per_node; }

Referenced by MooseVariableScalar::computeAD().

◆ getMinQuadratureOrder()

Order SystemBase::getMinQuadratureOrder ( )
virtualinherited

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

Returns
The minimal order of quadrature

Reimplemented in AuxiliarySystem.

Definition at line 232 of file SystemBase.C.

233 {
234  Order order = CONSTANT;
235  const std::vector<MooseVariableFEBase *> & vars = _vars[0].fieldVariables();
236  for (const auto & var : vars)
237  {
238  FEType fe_type = var->feType();
239  if (fe_type.default_quadrature_order() > order)
240  order = fe_type.default_quadrature_order();
241  }
242 
243  return order;
244 }

◆ getScalarVariable() [1/2]

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

Gets a reference to a scalar variable with specified number.

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

Definition at line 142 of file SystemBase.C.

143 {
144  MooseVariableScalar * var = dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_name));
145  if (!var)
146  mooseError("Scalar variable '" + var_name + "' does not exist in this system");
147  return *var;
148 }

Referenced by Assembly::addJacobianOffDiagScalar(), VectorIntegratedBC::computeJacobianBlockScalar(), ArrayIntegratedBC::computeJacobianBlockScalar(), IntegratedBC::computeJacobianBlockScalar(), ODEKernel::computeOffDiagJacobian(), VectorKernel::computeOffDiagJacobianScalar(), ArrayKernel::computeOffDiagJacobianScalar(), Kernel::computeOffDiagJacobianScalar(), DisplacedProblem::getScalarVariable(), Assembly::init(), and ReferenceResidualProblem::initialSetup().

◆ getScalarVariable() [2/2]

MooseVariableScalar & SystemBase::getScalarVariable ( THREAD_ID  tid,
unsigned int  var_number 
)
virtualinherited

Gets a reference to a variable with specified number.

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

Definition at line 151 of file SystemBase.C.

152 {
153  MooseVariableScalar * var =
154  dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_number));
155  if (!var)
156  mooseError("variable #" + Moose::stringify(var_number) + " does not exist in this system");
157  return *var;
158 }

◆ getScalarVariables()

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

◆ getSharedTimeIntegrator()

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

Definition at line 766 of file SystemBase.h.

766 { return _time_integrator; }

Referenced by DisplacedProblem::DisplacedProblem().

◆ getSubdomainsForVar()

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

Definition at line 659 of file SystemBase.h.

660  {
661  return _var_map.at(var_number);
662  }

◆ getTimeIntegrator() [1/2]

TimeIntegrator* SystemBase::getTimeIntegrator ( )
inlineinherited

◆ getTimeIntegrator() [2/2]

const TimeIntegrator* SystemBase::getTimeIntegrator ( ) const
inlineinherited

Definition at line 764 of file SystemBase.h.

764 { return _time_integrator.get(); }

◆ getVariable() [1/2]

MooseVariableFEBase & SystemBase::getVariable ( THREAD_ID  tid,
const std::string &  var_name 
)
inherited

Gets a reference to a variable of with specified name.

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

Definition at line 109 of file SystemBase.C.

110 {
111  MooseVariableFEBase * var = dynamic_cast<MooseVariableFEBase *>(_vars[tid].getVariable(var_name));
112  if (!var)
113  mooseError("Variable '", var_name, "' does not exist in this system");
114  return *var;
115 }

Referenced by Assembly::addJacobianBlock(), Assembly::addJacobianBlockNonlocal(), Assembly::addJacobianNeighbor(), SystemBase::addVariableToZeroOnJacobian(), SystemBase::addVariableToZeroOnResidual(), VectorIntegratedBC::computeJacobianBlock(), ArrayIntegratedBC::computeJacobianBlock(), NonlocalIntegratedBC::computeJacobianBlock(), NonlocalKernel::computeNonlocalOffDiagJacobian(), NonlocalIntegratedBC::computeNonlocalOffDiagJacobian(), ArrayDGKernel::computeOffDiagElemNeighJacobian(), Kernel::computeOffDiagJacobian(), VectorKernel::computeOffDiagJacobian(), ArrayKernel::computeOffDiagJacobian(), EigenKernel::computeOffDiagJacobian(), ArrayNodalBC::computeOffDiagJacobian(), NonlocalKernel::computeOffDiagJacobian(), KernelGrad::computeOffDiagJacobian(), KernelValue::computeOffDiagJacobian(), NodeFaceConstraint::computeOffDiagJacobian(), Assembly::copyFaceShapes(), Assembly::copyNeighborShapes(), Assembly::copyShapes(), SystemBase::copyVars(), FieldSplitPreconditioner::FieldSplitPreconditioner(), FiniteDifferencePreconditioner::FiniteDifferencePreconditioner(), EqualValueEmbeddedConstraint::getConnectedDofIndices(), NodeElemConstraint::getConnectedDofIndices(), NodeFaceConstraint::getConnectedDofIndices(), SystemBase::getScalarVariable(), SubProblem::getVariableHelper(), Assembly::init(), NodalNormalsPreprocessor::initialize(), ReferenceResidualProblem::initialSetup(), Assembly::initNonlocalCoupling(), PNGOutput::makeMeshFunc(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), Assembly::prepareBlock(), Assembly::prepareBlockNonlocal(), AddPeriodicBCAction::setPeriodicVars(), SingleMatrixPreconditioner::SingleMatrixPreconditioner(), and UpdateErrorVectorsThread::UpdateErrorVectorsThread().

◆ getVariable() [2/2]

MooseVariableFEBase & SystemBase::getVariable ( THREAD_ID  tid,
unsigned int  var_number 
)
inherited

Gets a reference to a variable with specified number.

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

Definition at line 118 of file SystemBase.C.

119 {
120  if (var_number < _numbered_vars[tid].size())
121  if (_numbered_vars[tid][var_number])
122  return *_numbered_vars[tid][var_number];
123 
124  mooseError("Variable #", Moose::stringify(var_number), " does not exist in this system");
125 }

◆ getVariableBlocks()

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

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

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

Definition at line 161 of file SystemBase.C.

162 {
163  mooseAssert(_var_map.find(var_number) != _var_map.end(), "Variable does not exist.");
164  if (_var_map[var_number].empty())
165  return nullptr;
166  else
167  return &_var_map[var_number];
168 }

Referenced by PhysicsBasedPreconditioner::addSystem().

◆ getVariableNames()

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

◆ getVariables()

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

◆ getVector() [1/3]

NumericVector< Number > & DisplacedSystem::getVector ( const std::string &  name)
overridevirtual

Get a raw NumericVector.

Get a raw NumericVector with the given name.

Reimplemented from SystemBase.

Definition at line 42 of file DisplacedSystem.C.

43 {
44  if (_sys.have_vector(name))
45  return _sys.get_vector(name);
46  else
48 }

◆ getVector() [2/3]

virtual const NumericVector<Number>& DisplacedSystem::getVector ( TagID  tag) const
inlineoverridevirtual

Get a raw NumericVector.

Reimplemented from SystemBase.

Definition at line 39 of file DisplacedSystem.h.

40  {
41  return _undisplaced_system.getVector(tag_id);
42  }

◆ getVector() [3/3]

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

Get a raw NumericVector.

Reimplemented from SystemBase.

Definition at line 35 of file DisplacedSystem.h.

36  {
37  return _undisplaced_system.getVector(tag_id);
38  }

◆ hasMatrix()

virtual bool DisplacedSystem::hasMatrix ( TagID  tag) const
inlineoverridevirtual

Check if the tagged matrix exists in the system.

Reimplemented from SystemBase.

Definition at line 198 of file DisplacedSystem.h.

199  {
200  return _undisplaced_system.hasMatrix(tag_id);
201  }

◆ hasScalarVariable()

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

Definition at line 719 of file SystemBase.C.

720 {
721  if (system().has_variable(var_name))
722  return system().variable_type(var_name).family == SCALAR;
723  else
724  return false;
725 }

Referenced by ComputeFullJacobianThread::computeFaceJacobian(), ComputeFullJacobianThread::computeJacobian(), NonlinearSystemBase::computeJacobianInternal(), SystemBase::copyVars(), DisplacedProblem::getScalarVariable(), DisplacedProblem::hasScalarVariable(), and AddPeriodicBCAction::setPeriodicVars().

◆ hasVariable()

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

Query a system for a variable.

Parameters
var_namename of the variable
Returns
true if the variable exists

Definition at line 694 of file SystemBase.C.

695 {
696  auto & names = getVariableNames();
697  if (system().has_variable(var_name))
698  return system().variable_type(var_name).family != SCALAR;
699  if (std::find(names.begin(), names.end(), var_name) != names.end())
700  // array variable
701  return true;
702  else
703  return false;
704 }

Referenced by ADDGKernel< compute_stage >::ADDGKernel(), ADKernelTempl< T, compute_stage >::ADKernelTempl(), ArrayDGKernel::ArrayDGKernel(), ArrayKernel::ArrayKernel(), SystemBase::copyVars(), DGKernel::DGKernel(), FEProblemBase::duplicateVariableCheck(), DisplacedProblem::getArrayVariable(), DisplacedProblem::getStandardVariable(), DisplacedProblem::getSystem(), SubProblem::getVariableHelper(), DisplacedProblem::getVectorVariable(), DisplacedProblem::hasVariable(), InterfaceKernelTempl< T >::InterfaceKernelTempl(), Kernel::Kernel(), and PNGOutput::makeMeshFunc().

◆ hasVector() [1/2]

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

◆ hasVector() [2/2]

virtual bool DisplacedSystem::hasVector ( TagID  tag_id) const
inlineoverridevirtual

Check if the tagged vector exists in the system.

Reimplemented from SystemBase.

Definition at line 193 of file DisplacedSystem.h.

194  {
195  return _undisplaced_system.hasVector(tag_id);
196  }

◆ init()

void DisplacedSystem::init ( )
overridevirtual

Initialize the system.

Reimplemented from SystemBase.

Definition at line 37 of file DisplacedSystem.C.

38 {
39 }

Referenced by DisplacedProblem::init().

◆ initializeObjects()

virtual void SystemBase::initializeObjects ( )
inlinevirtualinherited

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

Definition at line 168 of file SystemBase.h.

168 {};

◆ isArrayVariable()

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

If a variable is an array variable.

Definition at line 707 of file SystemBase.C.

708 {
709  auto & names = getVariableNames();
710  if (!system().has_variable(var_name) &&
711  std::find(names.begin(), names.end(), var_name) != names.end())
712  // array variable
713  return true;
714  else
715  return false;
716 }

◆ isScalarVariable()

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

Definition at line 728 of file SystemBase.C.

729 {
730  return (system().variable(var_num).type().family == SCALAR);
731 }

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

◆ matrixTagActive()

bool SystemBase::matrixTagActive ( TagID  tag) const
virtualinherited

If or not a matrix tag is active.

Definition at line 958 of file SystemBase.C.

959 {
960  mooseAssert(_subproblem.matrixTagExists(tag), "Matrix tag " << tag << " does not exist");
961 
962  return tag < _matrix_tag_active_flags.size() && _matrix_tag_active_flags[tag];
963 }

◆ mesh() [1/2]

virtual MooseMesh& SystemBase::mesh ( )
inlinevirtualinherited

◆ mesh() [2/2]

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

Definition at line 107 of file SystemBase.h.

107 { return _mesh; }

◆ name()

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

◆ nonTimeVectorTag()

virtual TagID DisplacedSystem::nonTimeVectorTag ( )
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 50 of file DisplacedSystem.h.

Referenced by DisplacedProblem::addCachedResidualDirectly().

◆ number()

unsigned int SystemBase::number ( ) const
virtualinherited

◆ nVariables()

unsigned int SystemBase::nVariables ( ) const
virtualinherited

Get the number of variables in this system.

Returns
the number of variables

Definition at line 734 of file SystemBase.C.

735 {
736  unsigned int n = 0;
737  for (auto & var : _vars[0].fieldVariables())
738  n += var->count();
739  n += _vars[0].scalars().size();
740 
741  return n;
742 }

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

◆ prepare()

void SystemBase::prepare ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 247 of file SystemBase.C.

248 {
250  {
251  const std::set<MooseVariableFEBase *> & active_elemental_moose_variables =
253  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
254  for (const auto & var : vars)
255  var->clearDofIndices();
256 
257  for (const auto & var : active_elemental_moose_variables)
258  if (&(var->sys()) == this)
259  var->prepare();
260  }
261  else
262  {
263  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
264  for (const auto & var : vars)
265  var->prepare();
266  }
267 }

Referenced by DisplacedProblem::prepare(), DisplacedProblem::reinitDirac(), SubProblem::reinitElemFaceRef(), and DisplacedProblem::reinitElemPhys().

◆ prepareFace()

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

Prepare the system for use on sides.

This will try to reuse the preparation done on the element.

Parameters
tidID of the thread
resize_dataPass True if this system needs to resize residual and jacobian datastructures based on preparing this face

Definition at line 270 of file SystemBase.C.

271 {
272  // We only need to do something if the element prepare was restricted
274  {
275  const std::set<MooseVariableFEBase *> & active_elemental_moose_variables =
277 
278  std::vector<MooseVariableFEBase *> newly_prepared_vars;
279 
280  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
281  for (const auto & var : vars)
282  {
283  // If it wasn't in the active list, we need to prepare it
284  if (&(var->sys()) == this && !active_elemental_moose_variables.count(var))
285  {
286  var->prepare();
287  newly_prepared_vars.push_back(var);
288  }
289  }
290 
291  // Make sure to resize the residual and jacobian datastructures for all the new variables
292  if (resize_data)
293  for (const auto var_ptr : newly_prepared_vars)
294  {
295  _subproblem.assembly(tid).prepareVariable(var_ptr);
298  }
299  }
300 }

Referenced by DisplacedProblem::prepareFace().

◆ prepareLowerD()

void SystemBase::prepareLowerD ( THREAD_ID  tid)
virtualinherited

Prepare the system for use for lower dimensional elements.

Parameters
tidID of the thread

Definition at line 311 of file SystemBase.C.

312 {
313  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
314  for (const auto & var : vars)
315  var->prepareLowerD();
316 }

Referenced by SubProblem::reinitLowerDElemRef().

◆ prepareNeighbor()

void SystemBase::prepareNeighbor ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 303 of file SystemBase.C.

304 {
305  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
306  for (const auto & var : vars)
307  var->prepareNeighbor();
308 }

Referenced by DisplacedProblem::reinitNeighbor(), SubProblem::reinitNeighborFaceRef(), and DisplacedProblem::reinitNeighborPhys().

◆ reinitElem()

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

Reinit an element assembly info.

Parameters
elemWhich element we are reinitializing for
tidID of the thread

Reimplemented in AuxiliarySystem.

Definition at line 319 of file SystemBase.C.

320 {
321 
323  {
324  const std::set<MooseVariableFEBase *> & active_elemental_moose_variables =
326  for (const auto & var : active_elemental_moose_variables)
327  if (&(var->sys()) == this)
328  var->computeElemValues();
329  }
330  else
331  {
332  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
333  for (const auto & var : vars)
334  var->computeElemValues();
335  }
336 }

Referenced by DisplacedProblem::reinitElem().

◆ reinitElemFace()

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

Reinit assembly info for a side of an element.

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

Reimplemented in AuxiliarySystem.

Definition at line 339 of file SystemBase.C.

343 {
344  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
345  for (const auto & var : vars)
346  var->computeElemValuesFace();
347 }

Referenced by DisplacedProblem::reinitElemFace(), SubProblem::reinitElemFaceRef(), and DisplacedProblem::reinitNeighbor().

◆ reinitLowerD()

void SystemBase::reinitLowerD ( THREAD_ID  tid)
virtualinherited

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

Definition at line 369 of file SystemBase.C.

370 {
371  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
372  for (const auto & var : vars)
373  var->computeLowerDValues();
374 }

Referenced by SubProblem::reinitLowerDElemRef().

◆ reinitNeighbor()

void SystemBase::reinitNeighbor ( const Elem *  elem,
THREAD_ID  tid 
)
virtualinherited

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

Definition at line 361 of file SystemBase.C.

362 {
363  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
364  for (const auto & var : vars)
365  var->computeNeighborValues();
366 }

Referenced by DisplacedProblem::reinitNeighborPhys().

◆ reinitNeighborFace()

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

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

Definition at line 350 of file SystemBase.C.

354 {
355  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
356  for (const auto & var : vars)
357  var->computeNeighborValuesFace();
358 }

Referenced by DisplacedProblem::reinitNeighbor(), SubProblem::reinitNeighborFaceRef(), and DisplacedProblem::reinitNeighborPhys().

◆ reinitNode()

void SystemBase::reinitNode ( const Node *  node,
THREAD_ID  tid 
)
virtualinherited

Reinit nodal assembly info.

Parameters
nodeNode to reinit for
tidThread ID

Definition at line 377 of file SystemBase.C.

378 {
379  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
380  for (const auto & var : vars)
381  {
382  var->reinitNode();
383  if (var->isNodalDefined())
384  var->computeNodalValues();
385  }
386 }

Referenced by DisplacedProblem::reinitNode().

◆ reinitNodeFace()

void SystemBase::reinitNodeFace ( const Node *  node,
BoundaryID  bnd_id,
THREAD_ID  tid 
)
virtualinherited

Reinit nodal assembly info on a face.

Parameters
nodeNode to reinit
bnd_idBoundary ID
tidThread ID

Definition at line 389 of file SystemBase.C.

390 {
391  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
392  for (const auto & var : vars)
393  {
394  var->reinitNode();
395  if (var->isNodalDefined())
396  var->computeNodalValues();
397  }
398 }

Referenced by DisplacedProblem::reinitNodeFace().

◆ reinitNodes()

void SystemBase::reinitNodes ( const std::vector< dof_id_type > &  nodes,
THREAD_ID  tid 
)
virtualinherited

Reinit variables at a set of nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 401 of file SystemBase.C.

402 {
403  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
404  for (const auto & var : vars)
405  {
406  var->reinitNodes(nodes);
407  var->computeNodalValues();
408  }
409 }

Referenced by DisplacedProblem::reinitNodes().

◆ reinitNodesNeighbor()

void SystemBase::reinitNodesNeighbor ( const std::vector< dof_id_type > &  nodes,
THREAD_ID  tid 
)
virtualinherited

Reinit variables at a set of neighbor nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 412 of file SystemBase.C.

413 {
414  const std::vector<MooseVariableFEBase *> & vars = _vars[tid].fieldVariables();
415  for (const auto & var : vars)
416  {
417  var->reinitNodesNeighbor(nodes);
418  var->computeNodalNeighborValues();
419  }
420 }

Referenced by DisplacedProblem::reinitNodesNeighbor().

◆ reinitScalars()

void SystemBase::reinitScalars ( THREAD_ID  tid,
bool  reinit_for_derivative_reordering = false 
)
virtualinherited

Reinit scalar varaibles.

Parameters
tidThread ID
reinit_for_derivative_reorderingA flag indicating whether we are reinitializing for the purpose of re-ordering derivative information for ADNodalBCs

Definition at line 423 of file SystemBase.C.

424 {
425  const std::vector<MooseVariableScalar *> & vars = _vars[tid].scalars();
426  for (const auto & var : vars)
427  var->reinit(reinit_for_derivative_reordering);
428 }

Referenced by DisplacedProblem::reinitScalars().

◆ removeMatrix()

virtual void SystemBase::removeMatrix ( TagID  )
inlinevirtualinherited

Removes a jacobian sized vector.

Parameters
tag_nameThe name of the tag

Definition at line 732 of file SystemBase.h.

733  {
734  mooseError("Removing a matrix is not supported for this type of system!");
735  }

◆ removeVector() [1/2]

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

Remove a vector from the system with the given name.

Definition at line 1129 of file SystemBase.C.

1130 {
1131  system().remove_vector(name);
1132 }

Referenced by SystemBase::restoreOldSolutions().

◆ removeVector() [2/2]

void SystemBase::removeVector ( TagID  tag_id)
virtualinherited

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

Parameters
tag_idTag ID

Definition at line 597 of file SystemBase.C.

598 {
599  if (!_subproblem.vectorTagExists(tag_id))
600  mooseError("Cannot remove an unexisting tag or its associated vector, ",
601  tag_id,
602  ", that tag does not exist in System ",
603  name());
604 
605  if (hasVector(tag_id))
606  {
607  auto vector_name = _subproblem.vectorTagName(tag_id);
608  system().remove_vector(vector_name);
609  _tagged_vectors[tag_id] = nullptr;
610  }
611 }

◆ residualCopy()

virtual NumericVector<Number>& DisplacedSystem::residualCopy ( )
inlineoverridevirtual

Return the residual copy from the NonlinearSystem.

Returns
Residual copy

Reimplemented from SystemBase.

Definition at line 143 of file DisplacedSystem.h.

144  {
146  }

◆ residualGhosted()

virtual NumericVector<Number>& DisplacedSystem::residualGhosted ( )
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 147 of file DisplacedSystem.h.

148  {
150  }

◆ residualVectorTag()

virtual TagID DisplacedSystem::residualVectorTag ( )
inlineoverridevirtual

Reimplemented from SystemBase.

Definition at line 44 of file DisplacedSystem.h.

◆ restoreOldSolutions()

void SystemBase::restoreOldSolutions ( )
virtualinherited

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

Definition at line 514 of file SystemBase.C.

515 {
516  if (_saved_old)
517  {
518  solutionOld() = *_saved_old;
519  removeVector("save_solution_old");
520  _saved_old = nullptr;
521  }
522  if (_saved_older)
523  {
525  removeVector("save_solution_older");
526  _saved_older = nullptr;
527  }
529  {
531  removeVector("save_solution_dot_old");
532  _saved_dot_old = NULL;
533  }
535  {
537  removeVector("save_solution_dotdot_old");
538  _saved_dotdot_old = NULL;
539  }
540 }

Referenced by DisplacedProblem::restoreOldSolutions().

◆ restoreSolutions()

void SystemBase::restoreSolutions ( )
virtualinherited

Restore current solutions (call after your solve failed)

Reimplemented in NonlinearSystemBase.

Definition at line 1115 of file SystemBase.C.

1116 {
1117  *(const_cast<NumericVector<Number> *&>(currentSolution())) = solutionOld();
1118  solution() = solutionOld();
1119  if (solutionUDotOld())
1120  *solutionUDot() = *solutionUDotOld();
1121  if (solutionUDotDotOld())
1123  if (solutionPreviousNewton())
1125  system().update();
1126 }

Referenced by NonlinearSystemBase::restoreSolutions().

◆ saveOldSolutions()

void SystemBase::saveOldSolutions ( )
virtualinherited

Save the old and older solutions.

Definition at line 489 of file SystemBase.C.

490 {
491  if (!_saved_old)
492  _saved_old = &addVector("save_solution_old", false, PARALLEL);
493  if (!_saved_older)
494  _saved_older = &addVector("save_solution_older", false, PARALLEL);
496  _saved_dot_old = &addVector("save_solution_dot_old", false, PARALLEL);
498  _saved_dotdot_old = &addVector("save_solution_dotdot_old", false, PARALLEL);
499 
500  *_saved_old = solutionOld();
502 
503  if (solutionUDotOld())
505 
506  if (solutionUDotDotOld())
508 }

Referenced by DisplacedProblem::saveOldSolutions().

◆ serializedSolution()

virtual NumericVector<Number>& DisplacedSystem::serializedSolution ( )
inlineoverridevirtual

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

Implements SystemBase.

Definition at line 84 of file DisplacedSystem.h.

85  {
87  }

◆ solution() [1/2]

const NumericVector<Number>& DisplacedSystem::solution ( ) const
inlineoverridevirtual

Implements SystemBase.

Definition at line 99 of file DisplacedSystem.h.

99 { return _undisplaced_system.solution(); }

◆ solution() [2/2]

NumericVector<Number>& DisplacedSystem::solution ( )
inlineoverridevirtual

Implements SystemBase.

Definition at line 94 of file DisplacedSystem.h.

94 { return _undisplaced_system.solution(); }

◆ solutionOld() [1/2]

const NumericVector< Number > & DisplacedSystem::solutionOld ( ) const
overridevirtual

Implements SystemBase.

Definition at line 69 of file DisplacedSystem.C.

70 {
71  return *_sys.old_local_solution;
72 }

◆ solutionOld() [2/2]

NumericVector< Number > & DisplacedSystem::solutionOld ( )
overridevirtual

Implements SystemBase.

Definition at line 57 of file DisplacedSystem.C.

58 {
59  return *_sys.old_local_solution;
60 }

◆ solutionOlder() [1/2]

const NumericVector< Number > & DisplacedSystem::solutionOlder ( ) const
overridevirtual

Implements SystemBase.

Definition at line 75 of file DisplacedSystem.C.

76 {
77  return *_sys.older_local_solution;
78 }

◆ solutionOlder() [2/2]

NumericVector< Number > & DisplacedSystem::solutionOlder ( )
overridevirtual

Implements SystemBase.

Definition at line 63 of file DisplacedSystem.C.

64 {
65  return *_sys.older_local_solution;
66 }

◆ solutionPreviousNewton() [1/2]

const NumericVector<Number>* DisplacedSystem::solutionPreviousNewton ( ) const
inlineoverridevirtual

Implements SystemBase.

Definition at line 102 of file DisplacedSystem.h.

102 { return NULL; }

◆ solutionPreviousNewton() [2/2]

NumericVector<Number>* DisplacedSystem::solutionPreviousNewton ( )
inlineoverridevirtual

Implements SystemBase.

Definition at line 97 of file DisplacedSystem.h.

97 { return NULL; }

◆ solutionUDot() [1/2]

const NumericVector<Number>* DisplacedSystem::solutionUDot ( ) const
inlineoverridevirtual

Implements SystemBase.

Definition at line 117 of file DisplacedSystem.h.

118  {
120  }

◆ solutionUDot() [2/2]

NumericVector<Number>* DisplacedSystem::solutionUDot ( )
inlineoverridevirtual

Implements SystemBase.

Definition at line 104 of file DisplacedSystem.h.

104 { return _undisplaced_system.solutionUDot(); }

◆ solutionUDotDot() [1/2]

const NumericVector<Number>* DisplacedSystem::solutionUDotDot ( ) const
inlineoverridevirtual

Implements SystemBase.

Definition at line 121 of file DisplacedSystem.h.

122  {
124  }

◆ solutionUDotDot() [2/2]

NumericVector<Number>* DisplacedSystem::solutionUDotDot ( )
inlineoverridevirtual

Implements SystemBase.

Definition at line 105 of file DisplacedSystem.h.

106  {
108  }

◆ solutionUDotDotOld() [1/2]

const NumericVector<Number>* DisplacedSystem::solutionUDotDotOld ( ) const
inlineoverridevirtual

Implements SystemBase.

Definition at line 129 of file DisplacedSystem.h.

130  {
132  }

◆ solutionUDotDotOld() [2/2]

NumericVector<Number>* DisplacedSystem::solutionUDotDotOld ( )
inlineoverridevirtual

Implements SystemBase.

Definition at line 113 of file DisplacedSystem.h.

114  {
116  }

◆ solutionUDotOld() [1/2]

const NumericVector<Number>* DisplacedSystem::solutionUDotOld ( ) const
inlineoverridevirtual

Implements SystemBase.

Definition at line 125 of file DisplacedSystem.h.

126  {
128  }

◆ solutionUDotOld() [2/2]

NumericVector<Number>* DisplacedSystem::solutionUDotOld ( )
inlineoverridevirtual

Implements SystemBase.

Definition at line 109 of file DisplacedSystem.h.

110  {
112  }

◆ solve()

void SystemBase::solve ( )
virtualinherited

Solve the system (using libMesh magic)

Reimplemented in NonlinearSystemBase, NonlinearSystem, NonlinearEigenSystem, and DumpObjectsNonlinearSystem.

Definition at line 1073 of file SystemBase.C.

1074 {
1075  system().solve();
1076 }

◆ subproblem() [1/2]

virtual SubProblem& SystemBase::subproblem ( )
inlinevirtualinherited

◆ subproblem() [2/2]

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

Definition at line 109 of file SystemBase.h.

109 { return _subproblem; }

◆ sys()

virtual TransientExplicitSystem& DisplacedSystem::sys ( )
inlinevirtual

◆ system() [1/2]

const System & DisplacedSystem::system ( ) const
overridevirtual

Implements SystemBase.

Definition at line 87 of file DisplacedSystem.C.

88 {
89  return _sys;
90 }

◆ system() [2/2]

System & DisplacedSystem::system ( )
overridevirtual

Get the reference to the libMesh system.

Implements SystemBase.

Definition at line 81 of file DisplacedSystem.C.

82 {
83  return _sys;
84 }

Referenced by DisplacedProblem::getSystem().

◆ systemMatrixTag()

virtual TagID DisplacedSystem::systemMatrixTag ( )
inlineoverridevirtual

Return the Matrix Tag ID for System.

Reimplemented from SystemBase.

Definition at line 46 of file DisplacedSystem.h.

◆ timeMatrixTag()

TagID SystemBase::timeMatrixTag ( )
virtualinherited

Return the Matrix Tag ID for Time.

Definition at line 761 of file SystemBase.C.

762 {
763  mooseError("Not implemented yet");
764  return 0;
765 }

◆ timeVectorTag()

virtual TagID DisplacedSystem::timeVectorTag ( )
inlineoverridevirtual

Ideally, we should not need this API.

There exists a really bad API "addCachedResidualDirectly " in FEProblem and DisplacedProblem This API should go away once addCachedResidualDirectly is removed in the future Return Tag ID for Time

Reimplemented from SystemBase.

Definition at line 48 of file DisplacedSystem.h.

Referenced by DisplacedProblem::addCachedResidualDirectly().

◆ update()

void SystemBase::update ( )
virtualinherited

◆ zeroTaggedVectors()

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

Zero all vectors for given tags.

Definition at line 587 of file SystemBase.C.

588 {
589  for (auto & tag : tags)
590  {
591  mooseAssert(_subproblem.vectorTagExists(tag), "Tag: " << tag << " does not exsit");
592  getVector(tag).zero();
593  }
594 }

Referenced by NonlinearSystemBase::computeResidualTags().

◆ zeroVariables()

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

Zero out the solution for the list of variables passed in.

Reimplemented from SystemBase.

Definition at line 188 of file DisplacedSystem.h.

189  {
190  _undisplaced_system.zeroVariables(vars_to_be_zeroed);
191  }

◆ zeroVariablesForJacobian()

void SystemBase::zeroVariablesForJacobian ( )
virtualinherited

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

Definition at line 226 of file SystemBase.C.

◆ zeroVariablesForResidual()

void SystemBase::zeroVariablesForResidual ( )
virtualinherited

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

Definition at line 220 of file SystemBase.C.

Member Data Documentation

◆ _app

MooseApp& SystemBase::_app
protectedinherited

◆ _computing_scaling_jacobian

bool SystemBase::_computing_scaling_jacobian
protectedinherited

Flag used to indicate whether we are computing the scaling Jacobian.

Definition at line 827 of file SystemBase.h.

Referenced by NonlinearSystemBase::computeJacobianInternal(), NonlinearSystem::computeScaling(), NonlinearSystemBase::computeTimeDerivatives(), and SystemBase::computingScalingJacobian().

◆ _computing_scaling_residual

bool SystemBase::_computing_scaling_residual
protectedinherited

◆ _du_dot_du

Real SystemBase::_du_dot_du
protectedinherited

Definition at line 788 of file SystemBase.h.

Referenced by SystemBase::duDotDu().

◆ _du_dotdot_du

Real SystemBase::_du_dotdot_du
protectedinherited

Definition at line 789 of file SystemBase.h.

Referenced by SystemBase::duDotDotDu().

◆ _factory

Factory& SystemBase::_factory
protectedinherited

◆ _matrix_tag_active_flags

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

◆ _max_var_n_dofs_per_elem

size_t SystemBase::_max_var_n_dofs_per_elem
protectedinherited

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

Definition at line 812 of file SystemBase.h.

Referenced by SystemBase::assignMaxVarNDofsPerElem(), and SystemBase::getMaxVarNDofsPerElem().

◆ _max_var_n_dofs_per_node

size_t SystemBase::_max_var_n_dofs_per_node
protectedinherited

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

Definition at line 815 of file SystemBase.h.

Referenced by SystemBase::assignMaxVarNDofsPerNode(), and SystemBase::getMaxVarNDofsPerNode().

◆ _max_var_number

unsigned int SystemBase::_max_var_number
protectedinherited

Maximum variable number.

Definition at line 783 of file SystemBase.h.

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

◆ _mesh

MooseMesh& SystemBase::_mesh
protectedinherited

◆ _name

std::string SystemBase::_name
protectedinherited

The name of this system.

Definition at line 776 of file SystemBase.h.

◆ _numbered_vars

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

Map variable number to its pointer.

Definition at line 821 of file SystemBase.h.

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

◆ _saved_dot_old

NumericVector<Real>* SystemBase::_saved_dot_old
protectedinherited

Definition at line 803 of file SystemBase.h.

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

◆ _saved_dotdot_old

NumericVector<Real>* SystemBase::_saved_dotdot_old
protectedinherited

Definition at line 804 of file SystemBase.h.

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

◆ _saved_old

NumericVector<Real>* SystemBase::_saved_old
protectedinherited

Definition at line 799 of file SystemBase.h.

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

◆ _saved_older

NumericVector<Real>* SystemBase::_saved_older
protectedinherited

Definition at line 800 of file SystemBase.h.

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

◆ _subproblem

SubProblem& SystemBase::_subproblem
protectedinherited

◆ _sys

TransientExplicitSystem& DisplacedSystem::_sys
protected

Definition at line 222 of file DisplacedSystem.h.

Referenced by DisplacedSystem(), getVector(), solutionOld(), solutionOlder(), sys(), and system().

◆ _tagged_matrices

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

◆ _tagged_vectors

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

◆ _time_integrator

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

◆ _undisplaced_system

SystemBase& DisplacedSystem::_undisplaced_system
protected

◆ _var_kind

Moose::VarKindType SystemBase::_var_kind
protectedinherited

default kind of variables in this system

Definition at line 807 of file SystemBase.h.

◆ _var_map

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

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

Definition at line 781 of file SystemBase.h.

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

◆ _var_to_copy

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

Definition at line 809 of file SystemBase.h.

Referenced by SystemBase::addVariableToCopy(), and SystemBase::copyVars().

◆ _variable_warehouse

MooseObjectWarehouseBase<MooseVariableBase> SystemBase::_variable_warehouse
protectedinherited

Storage for MooseVariable objects.

Definition at line 824 of file SystemBase.h.

◆ _vars

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

◆ _vars_to_be_zeroed_on_jacobian

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

◆ _vars_to_be_zeroed_on_residual

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

The documentation for this class was generated from the following files:
MooseVariableFEBase
Definition: MooseVariableFEBase.h:27
SystemBase::getMatrix
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:858
SystemBase::addVector
virtual NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:543
SubProblem::vectorTagName
virtual TagName vectorTagName(TagID tag)
Retrieve the name associated with a TagID.
Definition: SubProblem.C:110
comm
MPI_Comm comm
Definition: PetscDMMoose.C:1505
Factory::create
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>())
Definition: Factory.C:93
type
MatType type
Definition: PetscDMMoose.C:1477
SystemBase::getVariable
MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:109
THREAD_ID
unsigned int THREAD_ID
Definition: MooseTypes.h:196
SubProblem::arrayVariableComponent
static std::string arrayVariableComponent(const std::string &var_name, unsigned int i)
Returns the variable name of a component of an array variable.
Definition: SubProblem.h:197
SystemBase::_saved_dotdot_old
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:804
SystemBase::residualVectorTag
virtual TagID residualVectorTag()
Definition: SystemBase.C:782
SystemBase::_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:812
MooseUtils::convert< int >
int convert< int >(const std::string &str, bool throw_on_failure)
Definition: MooseUtils.C:628
SystemBase::nonTimeVectorTag
virtual TagID nonTimeVectorTag()
Definition: SystemBase.C:775
SystemBase::removeVector
virtual void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Definition: SystemBase.C:1129
MooseVariableScalar
Class for scalar variables (they are different).
Definition: MooseVariableScalar.h:30
SystemBase::solutionPreviousNewton
virtual NumericVector< Number > * solutionPreviousNewton()=0
SystemBase::_computing_scaling_jacobian
bool _computing_scaling_jacobian
Flag used to indicate whether we are computing the scaling Jacobian.
Definition: SystemBase.h:827
DisplacedSystem::_sys
TransientExplicitSystem & _sys
Definition: DisplacedSystem.h:222
SystemBase::_factory
Factory & _factory
Definition: SystemBase.h:772
SystemBase::hasVector
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:748
SystemBase::_tagged_vectors
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:792
SystemBase::addVariableToZeroOnJacobian
virtual void addVariableToZeroOnJacobian(std::string var_name)
Adds this variable to the list of variables to be zeroed during each Jacobian evaluation.
Definition: SystemBase.C:183
SubProblem::getActiveElementalMooseVariables
virtual const std::set< MooseVariableFEBase * > & getActiveElementalMooseVariables(THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:251
MooseEnum
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
SystemBase::_saved_older
NumericVector< Real > * _saved_older
Definition: SystemBase.h:800
SystemBase::duDotDotDu
virtual Number & duDotDotDu()
Definition: SystemBase.h:205
SystemBase::disassociateAllTaggedVectors
virtual void disassociateAllTaggedVectors()
Disassociate all vectors, and then hasVector() will return false.
Definition: SystemBase.C:845
SystemBase::system
virtual System & system()=0
Get the reference to the libMesh system.
SystemBase::solutionUDotDotOld
virtual NumericVector< Number > * solutionUDotDotOld()=0
SubProblem::hasActiveElementalMooseVariables
virtual bool hasActiveElementalMooseVariables(THREAD_ID tid) const
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:257
SystemBase::residualGhosted
virtual NumericVector< Number > & residualGhosted()
Definition: SystemBase.h:360
VarCopyInfo
Information about variables that will be copied.
Definition: SystemBase.h:77
SystemBase::hasMatrix
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.C:852
SystemBase::_vars_to_be_zeroed_on_residual
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:785
SystemBase::_var_to_copy
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:809
SystemBase::disassociateVectorFromTag
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:831
SubProblem::numMatrixTags
virtual unsigned int numMatrixTags() const
The total number of tags.
Definition: SubProblem.h:162
SystemBase::systemMatrixTag
virtual TagID systemMatrixTag()
Return the Matrix Tag ID for System.
Definition: SystemBase.C:768
SystemBase::SystemBase
SystemBase(SubProblem &subproblem, const std::string &name, Moose::VarKindType var_kind)
Definition: SystemBase.C:83
SystemBase::_mesh
MooseMesh & _mesh
Definition: SystemBase.h:774
Moose::stringify
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:61
mooseError
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition: MooseError.h:210
SystemBase::timeVectorTag
virtual TagID timeVectorTag()
Ideally, we should not need this API.
Definition: SystemBase.C:754
InputParameters::set
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Definition: InputParameters.h:987
SystemBase::solution
virtual NumericVector< Number > & solution()=0
SystemBase::solutionOlder
virtual NumericVector< Number > & solutionOlder()=0
SystemBase::solutionOld
virtual NumericVector< Number > & solutionOld()=0
DisplacedSystem::_undisplaced_system
SystemBase & _undisplaced_system
Definition: DisplacedSystem.h:221
SystemBase::_saved_dot_old
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:803
SystemBase::_numbered_vars
std::vector< std::vector< MooseVariableFEBase * > > _numbered_vars
Map variable number to its pointer.
Definition: SystemBase.h:821
SystemBase::residualCopy
virtual NumericVector< Number > & residualCopy()
Definition: SystemBase.h:356
SystemBase::solutionUDotDot
virtual NumericVector< Number > * solutionUDotDot()=0
SystemBase::_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:815
SystemBase::addVariableToZeroOnResidual
virtual void addVariableToZeroOnResidual(std::string var_name)
Adds this variable to the list of variables to be zeroed during each residual evaluation.
Definition: SystemBase.C:171
SystemBase::_subproblem
SubProblem & _subproblem
Definition: SystemBase.h:769
SystemBase::disassociateAllTaggedMatrices
virtual void disassociateAllTaggedMatrices()
Clear all tagged matrices.
Definition: SystemBase.C:966
SystemBase::_vars_to_be_zeroed_on_jacobian
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:786
SystemBase::getVariableNames
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:739
SystemBase::hasScalarVariable
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:719
SystemBase::disassociateMatrixFromTag
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
disassociate a matirx from a tag
Definition: SystemBase.C:894
SystemBase::serializedSolution
virtual NumericVector< Number > & serializedSolution()=0
Returns a reference to a serialized version of the solution vector for this subproblem.
SystemBase::duDotDu
virtual Number & duDotDu()
Definition: SystemBase.h:204
SubProblem::assembly
virtual Assembly & assembly(THREAD_ID tid)=0
SubProblem::checkNonlocalCouplingRequirement
virtual bool checkNonlocalCouplingRequirement()
Definition: SubProblem.h:74
libMesh::TransientExplicitSystem
TransientSystem< ExplicitSystem > TransientExplicitSystem
Definition: DisplacedSystem.h:20
SubdomainID
subdomain_id_type SubdomainID
Definition: AutomaticMortarGeneration.h:48
SystemBase::_computing_scaling_residual
bool _computing_scaling_residual
Flag used to indicate whether we are computing the scaling Residual.
Definition: SystemBase.h:830
SystemBase::_saved_old
NumericVector< Real > * _saved_old
Definition: SystemBase.h:799
SystemBase::getVector
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector.
Definition: SystemBase.C:798
SystemBase::_time_integrator
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:818
DisplacedProblem::es
virtual EquationSystems & es() override
Definition: DisplacedProblem.h:46
SystemBase::zeroVariables
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:195
Assembly::prepareVariable
void prepareVariable(MooseVariableFEBase *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
Definition: Assembly.C:2364
SystemBase::_vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:779
MooseMesh::getSubdomainID
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
Definition: MooseMesh.C:1118
SystemBase::_matrix_tag_active_flags
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:796
SubProblem::matrixTagExists
virtual bool matrixTagExists(const TagName &tag_name)
Check to see if a particular Tag exists.
Definition: SubProblem.C:133
SystemBase::name
virtual const std::string & name() const
Definition: SystemBase.C:1135
SystemBase::augmentSendList
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.
Definition: SystemBase.C:431
SystemBase
Base class for a system (of equations)
Definition: SystemBase.h:95
SystemBase::associateMatrixToTag
virtual void associateMatrixToTag(SparseMatrix< Number > &matrix, TagID tag)
associate a matirx to a tag
Definition: SystemBase.C:882
SystemBase::_max_var_number
unsigned int _max_var_number
Maximum variable number.
Definition: SystemBase.h:783
SubProblem::vectorTagExists
virtual bool vectorTagExists(TagID tag)
Check to see if a particular Tag exists.
Definition: SubProblem.h:117
MooseVariableBase
Definition: MooseVariableBase.h:37
MooseVariableBase::isNodal
virtual bool isNodal() const
Is this variable nodal.
Definition: MooseVariableBase.h:104
SubProblem::defaultGhosting
bool defaultGhosting()
Whether or not the user has requested default ghosting ot be on.
Definition: SubProblem.h:87
SystemBase::associateVectorToTag
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:820
SystemBase::hasVariable
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
Definition: SystemBase.C:694
SystemBase::currentSolution
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
dof_map
DofMap & dof_map
Definition: PetscDMMoose.C:1503
Assembly::prepareVariableNonlocal
void prepareVariableNonlocal(MooseVariableFEBase *var)
Definition: Assembly.C:2392
SystemBase::_var_map
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:781
SystemBase::solutionUDot
virtual NumericVector< Number > * solutionUDot()=0
SystemBase::solutionUDotOld
virtual NumericVector< Number > * solutionUDotOld()=0
n
PetscInt n
Definition: PetscDMMoose.C:1504