www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
SystemBase Class Referenceabstract

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

#include <SystemBase.h>

Inheritance diagram for SystemBase:
[legend]

Public Member Functions

 SystemBase (SubProblem &subproblem, const std::string &name, Moose::VarKindType var_kind)
 
virtual ~SystemBase ()
 
virtual unsigned int number ()
 Gets the number of this system. More...
 
virtual MooseMeshmesh ()
 
virtual SubProblemsubproblem ()
 
virtual DofMap & dofMap ()
 Gets the dof map. More...
 
virtual System & system ()=0
 Get the reference to the libMesh system. More...
 
virtual const System & system () const =0
 
virtual void init ()
 Initialize the system. 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 const NumericVector< Number > *& currentSolution ()=0
 The solution vector that is currently being operated on. More...
 
virtual NumericVector< Number > & solution ()=0
 
virtual NumericVector< Number > & solutionOld ()=0
 
virtual NumericVector< Number > & solutionOlder ()=0
 
virtual NumericVector< Number > * solutionPreviousNewton ()=0
 
virtual Number & duDotDu ()
 
virtual NumericVector< Number > & solutionUDot ()
 
virtual NumericVector< Number > & residualVector (Moose::KernelType)
 
virtual bool hasResidualVector (Moose::KernelType) const
 
virtual void saveOldSolutions ()
 Save the old and older solutions. More...
 
virtual void restoreOldSolutions ()
 Restore the old and older solutions when the saved solutions present. More...
 
virtual bool hasVector (const std::string &name)
 Check if the named vector exists in the system. More...
 
virtual NumericVector< Number > & getVector (const std::string &name)
 Get a raw NumericVector. More...
 
virtual NumericVector< Number > & serializedSolution ()=0
 Returns a reference to a serialized version of the solution vector for this subproblem. More...
 
virtual NumericVector< Number > & residualCopy ()
 
virtual NumericVector< Number > & residualGhosted ()
 
virtual void augmentSendList (std::vector< dof_id_type > &send_list)
 Will modify the send_list to add all of the extra ghosted dofs for this system. More...
 
virtual void augmentSparsity (SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz)=0
 Will modify the sparsity pattern to add logical geometric connections. More...
 
virtual void addVariable (const std::string &var_name, const FEType &type, Real scale_factor, const std::set< SubdomainID > *const active_subdomains=NULL)
 Adds a variable to the system. More...
 
virtual bool hasVariable (const std::string &var_name)
 Query a system for a variable. More...
 
virtual bool hasScalarVariable (const std::string &var_name)
 
virtual bool isScalarVariable (unsigned int var_name)
 
virtual MooseVariablegetVariable (THREAD_ID tid, const std::string &var_name)
 Gets a reference to a variable of with specified name. More...
 
virtual MooseVariablegetVariable (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 ()
 Get the number of variables in this system. More...
 
virtual void addVariableToZeroOnResidual (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each residual evaluation. More...
 
virtual void addVariableToZeroOnJacobian (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each Jacobian evaluation. More...
 
virtual void zeroVariables (std::vector< std::string > &vars_to_be_zeroed)
 Zero out the solution for the list of variables passed in. More...
 
virtual void zeroVariablesForResidual ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on residual evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual void zeroVariablesForJacobian ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on Jacobian evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual Order getMinQuadratureOrder ()
 Get minimal quadrature order needed for integrating variables in this system. More...
 
virtual void prepare (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareFace (THREAD_ID tid, bool resize_data)
 Prepare the system for use on sides. More...
 
virtual void prepareNeighbor (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void 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 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 reinitNodeNeighbor (const Node *node, THREAD_ID tid)
 Reinit nodal assembly info for neighbor node. 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)
 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< MooseVariable * > & 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 NumericVector< Number > & addVector (const std::string &vector_name, const bool project, const ParallelType type)
 Adds a solution length vector to the system. More...
 
virtual const std::string & name ()
 
virtual void addScalarVariable (const std::string &var_name, Order order, Real scale_factor, const std::set< SubdomainID > *const active_subdomains=NULL)
 Adds a scalar variable. More...
 
const std::vector< VariableName > & getVariableNames () const
 
virtual void computeVariables (const NumericVector< Number > &)
 
void copyVars (ExodusII_IO &io)
 
virtual void copySolutionsBackwards ()
 Copy current solution into old and older. More...
 

Protected Attributes

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...
 
std::vector< std::string > _vars_to_be_zeroed_on_residual
 
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
 
Real _du_dot_du
 
NumericVector< Number > * _dummy_vec
 
NumericVector< Real > * _saved_old
 
NumericVector< Real > * _saved_older
 
Moose::VarKindType _var_kind
 default kind of variables in this system More...
 
std::vector< VarCopyInfo_var_to_copy
 

Detailed Description

Base class for a system (of equations)

Definition at line 91 of file SystemBase.h.

Constructor & Destructor Documentation

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

Definition at line 84 of file SystemBase.C.

87  : libMesh::ParallelObject(subproblem),
88  _subproblem(subproblem),
89  _app(subproblem.getMooseApp()),
91  _mesh(subproblem.mesh()),
92  _name(name),
93  _vars(libMesh::n_threads()),
94  _var_map(),
95  _dummy_vec(NULL),
96  _saved_old(NULL),
97  _saved_older(NULL),
98  _var_kind(var_kind)
99 {
100 }
virtual MooseMesh & mesh()=0
virtual const std::string & name()
Definition: SystemBase.h:453
Factory & _factory
Definition: SystemBase.h:481
NumericVector< Real > * _saved_older
Definition: SystemBase.h:501
Factory & getFactory()
Retrieve the Factory associated with this App.
Definition: MooseApp.h:253
SubProblem & _subproblem
Definition: SystemBase.h:478
Moose::VarKindType _var_kind
default kind of variables in this system
Definition: SystemBase.h:504
MooseApp & getMooseApp()
Get the MooseApp this object is associated with.
Definition: MooseObject.h:72
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:490
std::string _name
The name of this system.
Definition: SystemBase.h:485
MooseApp & _app
Definition: SystemBase.h:480
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MooseMesh & _mesh
Definition: SystemBase.h:483
NumericVector< Real > * _saved_old
Definition: SystemBase.h:500
NumericVector< Number > * _dummy_vec
Definition: SystemBase.h:497
virtual SystemBase::~SystemBase ( )
inlinevirtual

Definition at line 95 of file SystemBase.h.

95 {}

Member Function Documentation

void SystemBase::addExtraVectors ( )
virtual

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

Reimplemented in NonlinearSystemBase, and AuxiliarySystem.

Definition at line 660 of file SystemBase.C.

661 {
662 }
void SystemBase::addScalarVariable ( const std::string &  var_name,
Order  order,
Real  scale_factor,
const std::set< SubdomainID > *const  active_subdomains = NULL 
)
virtual

Adds a scalar variable.

Parameters
var_nameThe name of the variable
orderThe order of the variable
scale_factorThe scaling factor to be used with this scalar variable

Definition at line 530 of file SystemBase.C.

Referenced by DisplacedProblem::addAuxScalarVariable(), and DisplacedProblem::addScalarVariable().

534 {
535  FEType type(order, SCALAR);
536  unsigned int var_num = system().add_variable(var_name, type, active_subdomains);
537  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
538  {
539  // FIXME: we cannot refer fetype in libMesh at this point, so we will just make a copy in
540  // MooseVariableBase.
541  MooseVariableScalar * var =
542  new MooseVariableScalar(var_num, type, *this, _subproblem.assembly(tid), _var_kind);
543  var->scalingFactor(scale_factor);
544  _vars[tid].add(var_name, var);
545  }
546  if (active_subdomains == NULL)
547  _var_map[var_num] = std::set<SubdomainID>();
548  else
549  for (std::set<SubdomainID>::iterator it = active_subdomains->begin();
550  it != active_subdomains->end();
551  ++it)
552  _var_map[var_num].insert(*it);
553 }
virtual Assembly & assembly(THREAD_ID tid)=0
SubProblem & _subproblem
Definition: SystemBase.h:478
Moose::VarKindType _var_kind
default kind of variables in this system
Definition: SystemBase.h:504
virtual System & system()=0
Get the reference to the libMesh system.
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:490
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MatType type
Class for scalar variables (they are different).
unsigned int THREAD_ID
Definition: MooseTypes.h:79
void scalingFactor(Real factor)
Set the scaling factor for this variable.
void SystemBase::addVariable ( const std::string &  var_name,
const FEType &  type,
Real  scale_factor,
const std::set< SubdomainID > *const  active_subdomains = NULL 
)
virtual

Adds a variable to the system.

Parameters
var_namename of the variable
typeFE type of the variable
scale_factorthe scaling factor for the variable
active_subdomainsa list of subdomain ids this variable is active on

Reimplemented in AuxiliarySystem.

Definition at line 500 of file SystemBase.C.

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

504 {
505  unsigned int var_num = system().add_variable(var_name, type, active_subdomains);
506  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
507  {
508  // FIXME: we cannot refer fetype in libMesh at this point, so we will just make a copy in
509  // MooseVariableBase.
510  MooseVariableBase * var;
511  if (type == FEType(0, MONOMIAL))
512  var = new MooseVariableConstMonomial(
513  var_num, type, *this, _subproblem.assembly(tid), _var_kind);
514  else
515  var = new MooseVariable(var_num, type, *this, _subproblem.assembly(tid), _var_kind);
516 
517  var->scalingFactor(scale_factor);
518  _vars[tid].add(var_name, var);
519  }
520  if (active_subdomains == NULL)
521  _var_map[var_num] = std::set<SubdomainID>();
522  else
523  for (std::set<SubdomainID>::iterator it = active_subdomains->begin();
524  it != active_subdomains->end();
525  ++it)
526  _var_map[var_num].insert(*it);
527 }
Class for stuff related to variables.
Definition: MooseVariable.h:43
virtual Assembly & assembly(THREAD_ID tid)=0
SubProblem & _subproblem
Definition: SystemBase.h:478
Moose::VarKindType _var_kind
default kind of variables in this system
Definition: SystemBase.h:504
virtual System & system()=0
Get the reference to the libMesh system.
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:490
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MatType type
unsigned int THREAD_ID
Definition: MooseTypes.h:79
void scalingFactor(Real factor)
Set the scaling factor for this variable.
void SystemBase::addVariableToCopy ( const std::string &  dest_name,
const std::string &  source_name,
const std::string &  timestep 
)
virtual

Add info about variable that will be copied.

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

Definition at line 616 of file SystemBase.C.

Referenced by CopyNodalVarsAction::act().

619 {
620  _var_to_copy.push_back(VarCopyInfo(dest_name, source_name, timestep));
621 }
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:506
Information about variables that will be copied.
Definition: SystemBase.h:73
void SystemBase::addVariableToZeroOnJacobian ( std::string  var_name)
virtual

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

Parameters
var_nameThe name of the variable to be zeroed.

Reimplemented in DisplacedSystem.

Definition at line 156 of file SystemBase.C.

Referenced by DisplacedSystem::addVariableToZeroOnJacobian(), DGKernel::DGKernel(), IntegratedBC::IntegratedBC(), InterfaceKernel::InterfaceKernel(), KernelBase::KernelBase(), NodalBC::NodalBC(), and NodalKernel::NodalKernel().

157 {
158  _vars_to_be_zeroed_on_jacobian.push_back(var_name);
159 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:493
void SystemBase::addVariableToZeroOnResidual ( std::string  var_name)
virtual

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

Parameters
var_nameThe name of the variable to be zeroed.

Reimplemented in DisplacedSystem.

Definition at line 150 of file SystemBase.C.

Referenced by DisplacedSystem::addVariableToZeroOnResidual(), DGKernel::DGKernel(), IntegratedBC::IntegratedBC(), InterfaceKernel::InterfaceKernel(), KernelBase::KernelBase(), NodalBC::NodalBC(), and NodalKernel::NodalKernel().

151 {
152  _vars_to_be_zeroed_on_residual.push_back(var_name);
153 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:492
NumericVector< Number > & SystemBase::addVector ( const std::string &  vector_name,
const bool  project,
const ParallelType  type 
)
virtual

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

Referenced by NonlinearSystemBase::addExtraVectors(), AStableDirk4::AStableDirk4(), FEProblemBase::initNullSpaceVectors(), LStableDirk3::LStableDirk3(), LStableDirk4::LStableDirk4(), NonlinearSystemBase::residualGhosted(), NonlinearSystemBase::residualVector(), saveOldSolutions(), and Transient::Transient().

491 {
492  if (hasVector(vector_name))
493  return getVector(vector_name);
494 
495  NumericVector<Number> * vec = &system().add_vector(vector_name, project, type);
496  return *vec;
497 }
virtual bool hasVector(const std::string &name)
Check if the named vector exists in the system.
Definition: SystemBase.C:589
virtual System & system()=0
Get the reference to the libMesh system.
MatType type
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector.
Definition: SystemBase.C:598
void SystemBase::augmentSendList ( std::vector< dof_id_type > &  send_list)
virtual

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

Reimplemented in DisplacedSystem.

Definition at line 401 of file SystemBase.C.

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

402 {
403  std::set<dof_id_type> & ghosted_elems = _subproblem.ghostedElems();
404 
405  DofMap & dof_map = dofMap();
406 
407  std::vector<dof_id_type> dof_indices;
408 
409  System & sys = system();
410 
411  unsigned int sys_num = sys.number();
412 
413  unsigned int n_vars = sys.n_vars();
414 
415  for (const auto & elem_id : ghosted_elems)
416  {
417  Elem * elem = _mesh.elemPtr(elem_id);
418 
419  if (elem->active())
420  {
421  dof_map.dof_indices(elem, dof_indices);
422 
423  // Only need to ghost it if it's actually not on this processor
424  for (const auto & dof : dof_indices)
425  if (dof < dof_map.first_dof() || dof >= dof_map.end_dof())
426  send_list.push_back(dof);
427 
428  // Now add the DoFs from all of the nodes. This is necessary because of block
429  // restricted variables. A variable might not live _on_ this element but it
430  // might live on nodes connected to this element.
431  for (unsigned int n = 0; n < elem->n_nodes(); n++)
432  {
433  Node * node = elem->node_ptr(n);
434 
435  // Have to get each variable's dofs
436  for (unsigned int v = 0; v < n_vars; v++)
437  {
438  const Variable & var = sys.variable(v);
439  unsigned int var_num = var.number();
440  unsigned int n_comp = var.n_components();
441 
442  // See if this variable has any dofs at this node
443  if (node->n_dofs(sys_num, var_num) > 0)
444  {
445  // Loop over components of the variable
446  for (unsigned int c = 0; c < n_comp; c++)
447  send_list.push_back(node->dof_number(sys_num, var_num, c));
448  }
449  }
450  }
451  }
452  }
453 }
virtual Elem * elemPtr(const dof_id_type i)
Definition: MooseMesh.C:2115
virtual DofMap & dofMap()
Gets the dof map.
Definition: SystemBase.C:610
DofMap & dof_map
SubProblem & _subproblem
Definition: SystemBase.h:478
virtual std::set< dof_id_type > & ghostedElems()
Return the list of elements that should have their DoFs ghosted to this processor.
Definition: SubProblem.h:400
virtual System & system()=0
Get the reference to the libMesh system.
MooseMesh & _mesh
Definition: SystemBase.h:483
PetscInt n
virtual void SystemBase::augmentSparsity ( SparsityPattern::Graph &  sparsity,
std::vector< dof_id_type > &  n_nz,
std::vector< dof_id_type > &  n_oz 
)
pure virtual

Will modify the sparsity pattern to add logical geometric connections.

Implemented in NonlinearSystemBase, AuxiliarySystem, and DisplacedSystem.

Referenced by extraSparsity().

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

Definition at line 468 of file SystemBase.h.

468 {};
void SystemBase::copyOldSolutions ( )
virtual

Shifts the solutions backwards in time.

Definition at line 693 of file SystemBase.C.

Referenced by EigenExecutionerBase::inversePowerIteration().

694 {
699 }
virtual NumericVector< Number > & solutionOld()=0
virtual NumericVector< Number > * solutionPreviousNewton()=0
virtual NumericVector< Number > & solutionOlder()=0
virtual const NumericVector< Number > *& currentSolution()=0
The solution vector that is currently being operated on.
void SystemBase::copySolutionsBackwards ( )
virtual

Copy current solution into old and older.

Definition at line 680 of file SystemBase.C.

681 {
682  system().update();
687 }
virtual NumericVector< Number > & solutionOld()=0
virtual NumericVector< Number > * solutionPreviousNewton()=0
virtual System & system()=0
Get the reference to the libMesh system.
virtual NumericVector< Number > & solutionOlder()=0
virtual const NumericVector< Number > *& currentSolution()=0
The solution vector that is currently being operated on.
void SystemBase::copyVars ( ExodusII_IO &  io)

Definition at line 624 of file SystemBase.C.

625 {
626  int n_steps = io.get_num_time_steps();
627 
628  bool did_copy = false;
629  for (std::vector<VarCopyInfo>::iterator it = _var_to_copy.begin(); it != _var_to_copy.end(); ++it)
630  {
631  VarCopyInfo & vci = *it;
632  int timestep = -1;
633 
634  if (vci._timestep == "LATEST")
635  // Use the last time step in the file from which to retrieve the solution
636  timestep = n_steps;
637  else
638  {
639  std::istringstream ss(vci._timestep);
640  if (!((ss >> timestep) && ss.eof()) || timestep > n_steps)
641  mooseError("Invalid value passed as \"initial_from_file_timestep\". Expected \"LATEST\" or "
642  "a valid integer between 1 and ",
643  n_steps,
644  " inclusive, received ",
645  vci._timestep);
646  }
647 
648  did_copy = true;
649  if (getVariable(0, vci._dest_name).isNodal())
650  io.copy_nodal_solution(system(), vci._dest_name, vci._source_name, timestep);
651  else
652  io.copy_elemental_solution(system(), vci._dest_name, vci._source_name, timestep);
653  }
654 
655  if (did_copy)
656  solution().close();
657 }
std::string _source_name
Definition: SystemBase.h:83
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
virtual bool isNodal() const override
Is this variable nodal.
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:506
virtual MooseVariable & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:103
Information about variables that will be copied.
Definition: SystemBase.h:73
std::string _dest_name
Definition: SystemBase.h:82
virtual System & system()=0
Get the reference to the libMesh system.
std::string _timestep
Definition: SystemBase.h:84
virtual NumericVector< Number > & solution()=0
virtual const NumericVector<Number>*& SystemBase::currentSolution ( )
pure virtual
DofMap & SystemBase::dofMap ( )
virtual
virtual Number& SystemBase::duDotDu ( )
inlinevirtual
Order SystemBase::getMinQuadratureOrder ( )
virtual

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

Returns
The minimal order of quadrature

Reimplemented in AuxiliarySystem.

Definition at line 199 of file SystemBase.C.

200 {
201  Order order = CONSTANT;
202  std::vector<MooseVariable *> vars = _vars[0].variables();
203  for (const auto & var : vars)
204  {
205  FEType fe_type = var->feType();
206  if (fe_type.default_quadrature_order() > order)
207  order = fe_type.default_quadrature_order();
208  }
209 
210  return order;
211 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MooseVariableScalar & SystemBase::getScalarVariable ( THREAD_ID  tid,
const std::string &  var_name 
)
virtual

Gets a reference to a scalar variable with specified number.

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

Definition at line 121 of file SystemBase.C.

Referenced by Assembly::addJacobianOffDiagScalar(), IntegratedBC::computeJacobianBlockScalar(), ODEKernel::computeOffDiagJacobian(), Kernel::computeOffDiagJacobianScalar(), and DisplacedProblem::getScalarVariable().

122 {
123  MooseVariableScalar * var = dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_name));
124  if (var == NULL)
125  mooseError("Scalar variable '" + var_name + "' does not exist in this system");
126  return *var;
127 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
Class for scalar variables (they are different).
MooseVariableScalar & SystemBase::getScalarVariable ( THREAD_ID  tid,
unsigned int  var_number 
)
virtual

Gets a reference to a variable with specified number.

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

Definition at line 130 of file SystemBase.C.

131 {
132  MooseVariableScalar * var =
133  dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_number));
134  if (var == NULL)
135  mooseError("variable #" + Moose::stringify(var_number) + " does not exist in this system");
136  return *var;
137 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:66
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
Class for scalar variables (they are different).
const std::vector<MooseVariableScalar *>& SystemBase::getScalarVariables ( THREAD_ID  tid)
inline
const std::set<SubdomainID>& SystemBase::getSubdomainsForVar ( unsigned int  var_number) const
inline

Definition at line 427 of file SystemBase.h.

428  {
429  return _var_map.at(var_number);
430  }
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:490
MooseVariable & SystemBase::getVariable ( THREAD_ID  tid,
const std::string &  var_name 
)
virtual

Gets a reference to a variable of with specified name.

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

Definition at line 103 of file SystemBase.C.

Referenced by AdaptivityAction::act(), Assembly::addJacobianBlock(), Assembly::addJacobianBlockNonlocal(), Assembly::addJacobianNeighbor(), NonlocalIntegratedBC::computeJacobianBlock(), NonlocalKernel::computeNonlocalOffDiagJacobian(), NonlocalIntegratedBC::computeNonlocalOffDiagJacobian(), NonlocalKernel::computeOffDiagJacobian(), Assembly::copyFaceShapes(), Assembly::copyNeighborShapes(), Assembly::copyShapes(), copyVars(), FieldSplitPreconditioner::FieldSplitPreconditioner(), FiniteDifferencePreconditioner::FiniteDifferencePreconditioner(), NodeFaceConstraint::getConnectedDofIndices(), Marker::getMarkerValue(), DisplacedProblem::getVariable(), NodalNormalsPreprocessor::initialize(), FDKernel::perturbedResidual(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), AddPeriodicBCAction::setPeriodicVars(), SingleMatrixPreconditioner::SingleMatrixPreconditioner(), and UpdateErrorVectorsThread::UpdateErrorVectorsThread().

104 {
105  MooseVariable * var = dynamic_cast<MooseVariable *>(_vars[tid].getVariable(var_name));
106  if (var == NULL)
107  mooseError("Variable '" + var_name + "' does not exist in this system");
108  return *var;
109 }
Class for stuff related to variables.
Definition: MooseVariable.h:43
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MooseVariable & SystemBase::getVariable ( THREAD_ID  tid,
unsigned int  var_number 
)
virtual

Gets a reference to a variable with specified number.

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

Definition at line 112 of file SystemBase.C.

113 {
114  MooseVariable * var = dynamic_cast<MooseVariable *>(_vars[tid].getVariable(var_number));
115  if (var == NULL)
116  mooseError("variable #" + Moose::stringify(var_number) + " does not exist in this system");
117  return *var;
118 }
Class for stuff related to variables.
Definition: MooseVariable.h:43
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:66
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
const std::set< SubdomainID > * SystemBase::getVariableBlocks ( unsigned int  var_number)
virtual

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

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

Definition at line 140 of file SystemBase.C.

Referenced by PhysicsBasedPreconditioner::addSystem().

141 {
142  mooseAssert(_var_map.find(var_number) != _var_map.end(), "Variable does not exist.");
143  if (_var_map[var_number].empty())
144  return NULL;
145  else
146  return &_var_map[var_number];
147 }
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:490
const std::vector<VariableName>& SystemBase::getVariableNames ( ) const
inline

Definition at line 466 of file SystemBase.h.

Referenced by MooseEigenSystem::buildSystemDoFIndices(), NonlinearSystemBase::checkKernelCoverage(), and AddPeriodicBCAction::setPeriodicVars().

466 { return _vars[0].names(); };
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
const std::vector<MooseVariable *>& SystemBase::getVariables ( THREAD_ID  tid)
inline
NumericVector< Number > & SystemBase::getVector ( const std::string &  name)
virtual

Get a raw NumericVector.

Get a raw NumericVector with the given name.

Reimplemented in DisplacedSystem.

Definition at line 598 of file SystemBase.C.

Referenced by AuxiliarySystem::addVector(), addVector(), NonlinearSystemBase::computeResidual(), DisplacedSystem::getVector(), and Transient::solveStep().

599 {
600  return system().get_vector(name);
601 }
virtual const std::string & name()
Definition: SystemBase.h:453
virtual System & system()=0
Get the reference to the libMesh system.
virtual bool SystemBase::hasResidualVector ( Moose::KernelType  ) const
inlinevirtual
bool SystemBase::hasScalarVariable ( const std::string &  var_name)
virtual

Definition at line 565 of file SystemBase.C.

Referenced by ComputeFullJacobianThread::computeFaceJacobian(), ComputeFullJacobianThread::computeJacobian(), DisplacedProblem::getScalarVariable(), and DisplacedProblem::hasScalarVariable().

566 {
567  if (system().has_variable(var_name))
568  return system().variable_type(var_name).family == SCALAR;
569  else
570  return false;
571 }
virtual System & system()=0
Get the reference to the libMesh system.
bool SystemBase::hasVariable ( const std::string &  var_name)
virtual

Query a system for a variable.

Parameters
var_namename of the variable
Returns
true if the variable exists

Definition at line 556 of file SystemBase.C.

Referenced by DGKernel::DGKernel(), FEProblemBase::duplicateVariableCheck(), DisplacedProblem::getSystem(), DisplacedProblem::getVariable(), DisplacedProblem::hasVariable(), InterfaceKernel::InterfaceKernel(), and KernelBase::KernelBase().

557 {
558  if (system().has_variable(var_name))
559  return system().variable_type(var_name).family != SCALAR;
560  else
561  return false;
562 }
virtual System & system()=0
Get the reference to the libMesh system.
bool SystemBase::hasVector ( const std::string &  name)
virtual

Check if the named vector exists in the system.

Definition at line 589 of file SystemBase.C.

Referenced by AuxiliarySystem::addVector(), addVector(), and NonlinearSystemBase::computeResidual().

590 {
591  return system().have_vector(name);
592 }
virtual const std::string & name()
Definition: SystemBase.h:453
virtual System & system()=0
Get the reference to the libMesh system.
virtual void SystemBase::init ( )
inlinevirtual

Initialize the system.

Reimplemented in NonlinearSystemBase, AuxiliarySystem, and DisplacedSystem.

Definition at line 119 of file SystemBase.h.

119 {};
virtual void SystemBase::initializeObjects ( )
inlinevirtual

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

Definition at line 124 of file SystemBase.h.

124 {};
bool SystemBase::isScalarVariable ( unsigned int  var_name)
virtual

Definition at line 574 of file SystemBase.C.

Referenced by ODEKernel::computeOffDiagJacobian().

575 {
576  return (system().variable(var_num).type().family == SCALAR);
577 }
virtual System & system()=0
Get the reference to the libMesh system.
MatType type
virtual MooseMesh& SystemBase::mesh ( )
inlinevirtual
virtual const std::string& SystemBase::name ( )
inlinevirtual
unsigned int SystemBase::number ( )
virtual
unsigned int SystemBase::nVariables ( )
virtual

Get the number of variables in this system.

Returns
the number of variables

Definition at line 580 of file SystemBase.C.

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

581 {
582  return _vars[0].names().size();
583 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::prepare ( THREAD_ID  tid)
virtual

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 214 of file SystemBase.C.

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

215 {
217  {
218  const std::set<MooseVariable *> & active_elemental_moose_variables =
220  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
221  for (const auto & var : vars)
222  var->clearDofIndices();
223 
224  for (const auto & var : active_elemental_moose_variables)
225  if (&(var->sys()) == this)
226  var->prepare();
227  }
228  else
229  {
230  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
231  for (const auto & var : vars)
232  var->prepare();
233  }
234 }
virtual bool hasActiveElementalMooseVariables(THREAD_ID tid)
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:67
SubProblem & _subproblem
Definition: SystemBase.h:478
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
virtual const std::set< MooseVariable * > & getActiveElementalMooseVariables(THREAD_ID tid)
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:61
void SystemBase::prepareFace ( THREAD_ID  tid,
bool  resize_data 
)
virtual

Prepare the system for use on sides.

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

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

Definition at line 237 of file SystemBase.C.

Referenced by DisplacedProblem::prepareFace().

238 {
240  tid)) // We only need to do something if the element prepare was restricted
241  {
242  const std::set<MooseVariable *> & active_elemental_moose_variables =
244 
245  std::vector<MooseVariable *> newly_prepared_vars;
246 
247  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
248  for (const auto & var : vars)
249  {
250  if (&(var->sys()) == this &&
251  !active_elemental_moose_variables.count(
252  var)) // If it wasnt in the active list we need to prepare it
253  {
254  var->prepare();
255  newly_prepared_vars.push_back(var);
256  }
257  }
258 
259  // Make sure to resize the residual and jacobian datastructures for all the new variables
260  if (resize_data)
261  for (unsigned int i = 0; i < newly_prepared_vars.size(); i++)
262  {
263  _subproblem.assembly(tid).prepareVariable(newly_prepared_vars[i]);
265  _subproblem.assembly(tid).prepareVariableNonlocal(newly_prepared_vars[i]);
266  }
267  }
268 }
virtual Assembly & assembly(THREAD_ID tid)=0
virtual bool hasActiveElementalMooseVariables(THREAD_ID tid)
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:67
void prepareVariable(MooseVariable *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
Definition: Assembly.C:1076
SubProblem & _subproblem
Definition: SystemBase.h:478
virtual bool checkNonlocalCouplingRequirement()
Definition: SubProblem.h:62
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void prepareVariableNonlocal(MooseVariable *var)
Definition: Assembly.C:1098
virtual const std::set< MooseVariable * > & getActiveElementalMooseVariables(THREAD_ID tid)
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:61
void SystemBase::prepareNeighbor ( THREAD_ID  tid)
virtual

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 271 of file SystemBase.C.

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

272 {
273  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
274  for (const auto & var : vars)
275  var->prepareNeighbor();
276 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitElem ( const Elem *  elem,
THREAD_ID  tid 
)
virtual

Reinit an element assembly info.

Parameters
elemWhich element we are reinitializing for
tidID of the thread

Reimplemented in AuxiliarySystem.

Definition at line 279 of file SystemBase.C.

Referenced by DisplacedProblem::reinitElem().

280 {
281 
283  {
284  const std::set<MooseVariable *> & active_elemental_moose_variables =
286  for (const auto & var : active_elemental_moose_variables)
287  if (&(var->sys()) == this)
288  var->computeElemValues();
289  }
290  else
291  {
292  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
293  for (const auto & var : vars)
294  var->computeElemValues();
295  }
296 }
virtual bool hasActiveElementalMooseVariables(THREAD_ID tid)
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:67
SubProblem & _subproblem
Definition: SystemBase.h:478
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
virtual const std::set< MooseVariable * > & getActiveElementalMooseVariables(THREAD_ID tid)
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:61
void SystemBase::reinitElemFace ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
THREAD_ID  tid 
)
virtual

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

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

303 {
304  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
305  for (const auto & var : vars)
306  var->computeElemValuesFace();
307 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNeighbor ( const Elem *  elem,
THREAD_ID  tid 
)
virtual

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

Definition at line 321 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNeighborPhys().

322 {
323  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
324  for (const auto & var : vars)
325  var->computeNeighborValues();
326 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNeighborFace ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
THREAD_ID  tid 
)
virtual

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

Definition at line 310 of file SystemBase.C.

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

314 {
315  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
316  for (const auto & var : vars)
317  var->computeNeighborValuesFace();
318 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNode ( const Node *  node,
THREAD_ID  tid 
)
virtual

Reinit nodal assembly info.

Parameters
nodeNode to reinit for
tidThread ID

Definition at line 329 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNode().

330 {
331  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
332  for (const auto & var : vars)
333  {
334  if (var->isNodal())
335  {
336  var->reinitNode();
337  var->computeNodalValues();
338  }
339  }
340 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNodeFace ( const Node *  node,
BoundaryID  bnd_id,
THREAD_ID  tid 
)
virtual

Reinit nodal assembly info on a face.

Parameters
nodeNode to reinit
bnd_idBoundary ID
tidThread ID

Definition at line 343 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNodeFace().

344 {
345  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
346  for (const auto & var : vars)
347  {
348  if (var->isNodal())
349  {
350  var->reinitNode();
351  var->computeNodalValues();
352  }
353  }
354 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNodeNeighbor ( const Node *  node,
THREAD_ID  tid 
)
virtual

Reinit nodal assembly info for neighbor node.

Parameters
nodeNode to reinit for
tidThread ID

Definition at line 357 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNodeNeighbor().

358 {
359  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
360  for (const auto & var : vars)
361  {
362  if (var->isNodal())
363  {
364  var->reinitNodeNeighbor();
365  var->computeNodalNeighborValues();
366  }
367  }
368 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNodes ( const std::vector< dof_id_type > &  nodes,
THREAD_ID  tid 
)
virtual

Reinit variables at a set of nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 371 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNodes().

372 {
373  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
374  for (const auto & var : vars)
375  {
376  var->reinitNodes(nodes);
377  var->computeNodalValues();
378  }
379 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNodesNeighbor ( const std::vector< dof_id_type > &  nodes,
THREAD_ID  tid 
)
virtual

Reinit variables at a set of neighbor nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 382 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNodesNeighbor().

383 {
384  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
385  for (const auto & var : vars)
386  {
387  var->reinitNodesNeighbor(nodes);
388  var->computeNodalNeighborValues();
389  }
390 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitScalars ( THREAD_ID  tid)
virtual

Reinit scalar varaibles.

Parameters
tidThread ID

Definition at line 393 of file SystemBase.C.

Referenced by DisplacedProblem::reinitScalars().

394 {
395  const std::vector<MooseVariableScalar *> & vars = _vars[tid].scalars();
396  for (const auto & var : vars)
397  var->reinit();
398 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
virtual void SystemBase::removeVector ( const std::string &  name)
inlinevirtual

Remove a vector from the system with the given name.

Definition at line 435 of file SystemBase.h.

Referenced by restoreOldSolutions().

435 { system().remove_vector(name); }
virtual const std::string & name()
Definition: SystemBase.h:453
virtual System & system()=0
Get the reference to the libMesh system.
virtual NumericVector<Number>& SystemBase::residualCopy ( )
inlinevirtual

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 179 of file SystemBase.h.

Referenced by DisplacedSystem::residualCopy().

180  {
181  mooseError("This system does not support getting a copy of the residual");
182  }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
virtual NumericVector<Number>& SystemBase::residualGhosted ( )
inlinevirtual

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 183 of file SystemBase.h.

Referenced by DisplacedSystem::residualGhosted().

184  {
185  mooseError("This system does not support getting a ghosted copy of the residual");
186  }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
virtual NumericVector<Number>& SystemBase::residualVector ( Moose::KernelType  )
inlinevirtual

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 158 of file SystemBase.h.

Referenced by Assembly::addCachedResiduals(), and DisplacedSystem::residualVector().

158 { return *_dummy_vec; }
NumericVector< Number > * _dummy_vec
Definition: SystemBase.h:497
void SystemBase::restoreOldSolutions ( )
virtual

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

Definition at line 473 of file SystemBase.C.

Referenced by DisplacedProblem::restoreOldSolutions().

474 {
475  if (_saved_old)
476  {
477  solutionOld() = *_saved_old;
478  removeVector("save_solution_old");
479  _saved_old = NULL;
480  }
481  if (_saved_older)
482  {
484  removeVector("save_solution_older");
485  _saved_older = NULL;
486  }
487 }
virtual NumericVector< Number > & solutionOld()=0
virtual void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Definition: SystemBase.h:435
NumericVector< Real > * _saved_older
Definition: SystemBase.h:501
NumericVector< Real > * _saved_old
Definition: SystemBase.h:500
virtual NumericVector< Number > & solutionOlder()=0
void SystemBase::restoreSolutions ( )
virtual

Restore current solutions (call after your solve failed)

Reimplemented in NonlinearSystemBase.

Definition at line 705 of file SystemBase.C.

Referenced by NonlinearSystemBase::restoreSolutions().

706 {
707  *(const_cast<NumericVector<Number> *&>(currentSolution())) = solutionOld();
708  solution() = solutionOld();
711  system().update();
712 }
virtual NumericVector< Number > & solutionOld()=0
virtual NumericVector< Number > * solutionPreviousNewton()=0
virtual System & system()=0
Get the reference to the libMesh system.
virtual NumericVector< Number > & solution()=0
virtual const NumericVector< Number > *& currentSolution()=0
The solution vector that is currently being operated on.
void SystemBase::saveOldSolutions ( )
virtual

Save the old and older solutions.

Definition at line 459 of file SystemBase.C.

Referenced by DisplacedProblem::saveOldSolutions().

460 {
461  if (!_saved_old)
462  _saved_old = &addVector("save_solution_old", false, PARALLEL);
463  if (!_saved_older)
464  _saved_older = &addVector("save_solution_older", false, PARALLEL);
465  *_saved_old = solutionOld();
467 }
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:490
virtual NumericVector< Number > & solutionOld()=0
NumericVector< Real > * _saved_older
Definition: SystemBase.h:501
NumericVector< Real > * _saved_old
Definition: SystemBase.h:500
virtual NumericVector< Number > & solutionOlder()=0
virtual NumericVector<Number>& SystemBase::serializedSolution ( )
pure virtual

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

Implemented in NonlinearSystemBase, AuxiliarySystem, and DisplacedSystem.

Referenced by DisplacedSystem::serializedSolution().

virtual NumericVector<Number>& SystemBase::solution ( )
pure virtual
virtual NumericVector<Number>& SystemBase::solutionOld ( )
pure virtual
virtual NumericVector<Number>& SystemBase::solutionOlder ( )
pure virtual
virtual NumericVector<Number>* SystemBase::solutionPreviousNewton ( )
pure virtual
virtual NumericVector<Number>& SystemBase::solutionUDot ( )
inlinevirtual
void SystemBase::solve ( )
virtual

Solve the system (using libMesh magic)

Reimplemented in NonlinearSystemBase, NonlinearEigenSystem, and NonlinearSystem.

Definition at line 671 of file SystemBase.C.

672 {
673  system().solve();
674 }
virtual System & system()=0
Get the reference to the libMesh system.
virtual SubProblem& SystemBase::subproblem ( )
inlinevirtual
virtual System& SystemBase::system ( )
pure virtual
virtual const System& SystemBase::system ( ) const
pure virtual
void SystemBase::update ( )
virtual
void SystemBase::zeroVariables ( std::vector< std::string > &  vars_to_be_zeroed)
virtual

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

@ param vars_to_be_zeroed The variable names in this vector will have their solutions set to zero after this call

Reimplemented in DisplacedSystem.

Definition at line 162 of file SystemBase.C.

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

163 {
164  if (vars_to_be_zeroed.size() > 0)
165  {
166  NumericVector<Number> & solution = this->solution();
167 
168  AllLocalDofIndicesThread aldit(system(), vars_to_be_zeroed);
169  ConstElemRange & elem_range = *_mesh.getActiveLocalElementRange();
170  Threads::parallel_reduce(elem_range, aldit);
171 
172  std::set<dof_id_type> dof_indices_to_zero = aldit._all_dof_indices;
173 
174  solution.close();
175 
176  for (const auto & dof : dof_indices_to_zero)
177  solution.set(dof, 0);
178 
179  solution.close();
180 
181  // Call update to update the current_local_solution for this system
182  system().update();
183  }
184 }
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:724
Grab all the local dof indices for the variables passed in, in the system passed in.
virtual System & system()=0
Get the reference to the libMesh system.
MooseMesh & _mesh
Definition: SystemBase.h:483
virtual NumericVector< Number > & solution()=0
void SystemBase::zeroVariablesForJacobian ( )
virtual

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

Definition at line 193 of file SystemBase.C.

194 {
196 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:493
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:162
void SystemBase::zeroVariablesForResidual ( )
virtual

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

Definition at line 187 of file SystemBase.C.

188 {
190 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:492
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:162

Member Data Documentation

MooseApp& SystemBase::_app
protected

Definition at line 480 of file SystemBase.h.

Real SystemBase::_du_dot_du
protected

Definition at line 495 of file SystemBase.h.

NumericVector<Number>* SystemBase::_dummy_vec
protected

Definition at line 497 of file SystemBase.h.

Factory& SystemBase::_factory
protected
MooseMesh& SystemBase::_mesh
protected
std::string SystemBase::_name
protected

The name of this system.

Definition at line 485 of file SystemBase.h.

NumericVector<Real>* SystemBase::_saved_old
protected

Definition at line 500 of file SystemBase.h.

Referenced by restoreOldSolutions(), and saveOldSolutions().

NumericVector<Real>* SystemBase::_saved_older
protected

Definition at line 501 of file SystemBase.h.

Referenced by restoreOldSolutions(), and saveOldSolutions().

SubProblem& SystemBase::_subproblem
protected
Moose::VarKindType SystemBase::_var_kind
protected

default kind of variables in this system

Definition at line 504 of file SystemBase.h.

Referenced by addScalarVariable(), and addVariable().

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

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

Definition at line 490 of file SystemBase.h.

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

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

Definition at line 506 of file SystemBase.h.

Referenced by addVariableToCopy(), and copyVars().

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

Definition at line 493 of file SystemBase.h.

Referenced by addVariableToZeroOnJacobian(), and zeroVariablesForJacobian().

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

Definition at line 492 of file SystemBase.h.

Referenced by addVariableToZeroOnResidual(), and zeroVariablesForResidual().


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