www.mooseframework.org
SystemBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include <vector>
13 
14 #include "DataIO.h"
15 #include "MooseTypes.h"
16 #include "VariableWarehouse.h"
17 #include "InputParameters.h"
18 
19 // libMesh
20 #include "libmesh/exodusII_io.h"
21 #include "libmesh/parallel_object.h"
22 #include "libmesh/numeric_vector.h"
23 #include "libmesh/sparse_matrix.h"
24 
25 // Forward declarations
26 class Factory;
27 class MooseApp;
29 template <typename>
33 class MooseMesh;
34 class SubProblem;
35 class SystemBase;
36 class TimeIntegrator;
37 
38 // libMesh forward declarations
39 namespace libMesh
40 {
41 class System;
42 class DofMap;
43 class FEType;
44 }
45 
49 void extraSendList(std::vector<dof_id_type> & send_list, void * context);
50 
54 void extraSparsity(SparsityPattern::Graph & sparsity,
55  std::vector<dof_id_type> & n_nz,
56  std::vector<dof_id_type> & n_oz,
57  void * context);
58 
62 template <>
63 void dataStore(std::ostream & stream, SystemBase & system_base, void * context);
64 
68 template <>
69 void dataLoad(std::istream & stream, SystemBase & system_base, void * context);
70 
75 {
76  VarCopyInfo(const std::string & dest_name,
77  const std::string & source_name,
78  const std::string & timestep)
79  : _dest_name(dest_name), _source_name(source_name), _timestep(timestep)
80  {
81  }
82 
83  std::string _dest_name;
84  std::string _source_name;
85  std::string _timestep;
86 };
87 
92 class SystemBase : public libMesh::ParallelObject
93 {
94 public:
95  SystemBase(SubProblem & subproblem, const std::string & name, Moose::VarKindType var_kind);
96  virtual ~SystemBase() {}
97 
102  virtual unsigned int number() const;
103  virtual MooseMesh & mesh() { return _mesh; }
104  virtual const MooseMesh & mesh() const { return _mesh; }
105  virtual SubProblem & subproblem() { return _subproblem; }
106  virtual const SubProblem & subproblem() const { return _subproblem; }
107 
111  virtual DofMap & dofMap();
112 
116  virtual const DofMap & dofMap() const;
117 
121  virtual System & system() = 0;
122  virtual const System & system() const = 0;
123 
127  virtual void init(){};
128 
132  virtual void initializeObjects(){};
133 
138  virtual void addExtraVectors();
139 
143  virtual void update();
144 
148  virtual void solve();
149 
150  virtual void copyOldSolutions();
151  virtual void restoreSolutions();
152 
157  virtual const NumericVector<Number> * const & currentSolution() const = 0;
158 
159  virtual NumericVector<Number> & solution() = 0;
160  virtual NumericVector<Number> & solutionOld() = 0;
161  virtual NumericVector<Number> & solutionOlder() = 0;
162  virtual NumericVector<Number> * solutionPreviousNewton() = 0;
163  virtual const NumericVector<Number> & solution() const = 0;
164  virtual const NumericVector<Number> & solutionOld() const = 0;
165  virtual const NumericVector<Number> & solutionOlder() const = 0;
166  virtual const NumericVector<Number> * solutionPreviousNewton() const = 0;
167 
168  virtual Number & duDotDu() { return _du_dot_du; }
169  virtual Number & duDotDotDu() { return _du_dotdot_du; }
170  virtual const Number & duDotDu() const { return _du_dot_du; }
171  virtual const Number & duDotDotDu() const { return _du_dotdot_du; }
172 
173  // non-const getters
174  virtual NumericVector<Number> * solutionUDot() = 0;
175  virtual NumericVector<Number> * solutionUDotOld() = 0;
176  virtual NumericVector<Number> * solutionUDotDot() = 0;
177  virtual NumericVector<Number> * solutionUDotDotOld() = 0;
178  // const getters
179  virtual const NumericVector<Number> * solutionUDot() const = 0;
180  virtual const NumericVector<Number> * solutionUDotOld() const = 0;
181  virtual const NumericVector<Number> * solutionUDotDot() const = 0;
182  virtual const NumericVector<Number> * solutionUDotDotOld() const = 0;
183 
184  virtual void saveOldSolutions();
185  virtual void restoreOldSolutions();
186 
190  bool hasVector(const std::string & tag_name) const;
191 
195  virtual bool hasVector(TagID tag_id) const;
196 
203  virtual TagID timeVectorTag();
204 
208  virtual TagID timeMatrixTag();
209 
213  virtual TagID systemMatrixTag();
214 
215  /*
216  * Return TagID for nontime
217  */
218  virtual TagID nonTimeVectorTag();
219 
220  /*
221  * Return TagID for nontime
222  */
223  virtual TagID residualVectorTag();
224 
228  virtual NumericVector<Number> & getVector(const std::string & name);
229 
233  virtual NumericVector<Number> & getVector(TagID tag);
234 
238  virtual const NumericVector<Number> & getVector(TagID tag) const;
239 
243  virtual void associateVectorToTag(NumericVector<Number> & vec, TagID tag);
244 
248  virtual void disassociateVectorFromTag(NumericVector<Number> & vec, TagID tag);
249 
253  virtual void disassociateAllTaggedVectors();
254 
258  virtual bool hasMatrix(TagID tag) const;
259 
263  virtual SparseMatrix<Number> & getMatrix(TagID tag);
264 
268  virtual const SparseMatrix<Number> & getMatrix(TagID tag) const;
269 
273  virtual void activeAllMatrixTags();
274 
278  virtual void activeMatrixTag(TagID tag);
279 
283  virtual bool matrixTagActive(TagID tag) const;
284 
288  virtual void deactiveMatrixTag(TagID tag);
289 
293  virtual void deactiveAllMatrixTags();
294 
298  void closeTaggedMatrices(const std::set<TagID> & tags);
299 
303  virtual void associateMatrixToTag(SparseMatrix<Number> & matrix, TagID tag);
304 
308  virtual void disassociateMatrixFromTag(SparseMatrix<Number> & matrix, TagID tag);
309 
313  virtual void disassociateAllTaggedMatrices();
314 
318  virtual NumericVector<Number> & serializedSolution() = 0;
319 
320  virtual NumericVector<Number> & residualCopy()
321  {
322  mooseError("This system does not support getting a copy of the residual");
323  }
324  virtual NumericVector<Number> & residualGhosted()
325  {
326  mooseError("This system does not support getting a ghosted copy of the residual");
327  }
328 
332  virtual void augmentSendList(std::vector<dof_id_type> & send_list);
333 
337  virtual void augmentSparsity(SparsityPattern::Graph & sparsity,
338  std::vector<dof_id_type> & n_nz,
339  std::vector<dof_id_type> & n_oz) = 0;
340 
349  virtual void addVariable(const std::string & var_name,
350  const FEType & type,
351  Real scale_factor,
352  const std::set<SubdomainID> * const active_subdomains = NULL);
353 
355 
361  virtual bool hasVariable(const std::string & var_name) const;
362  virtual bool hasScalarVariable(const std::string & var_name) const;
364 
365  virtual bool isScalarVariable(unsigned int var_name) const;
366 
374  MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string & var_name);
375 
383  MooseVariableFEBase & getVariable(THREAD_ID tid, unsigned int var_number);
384 
392  template <typename T>
393  MooseVariableFE<T> & getFieldVariable(THREAD_ID tid, const std::string & var_name);
394 
402  template <typename T>
403  MooseVariableFE<T> & getFieldVariable(THREAD_ID tid, unsigned int var_number);
404 
412  virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, const std::string & var_name);
413 
421  virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, unsigned int var_number);
422 
429  virtual const std::set<SubdomainID> * getVariableBlocks(unsigned int var_number);
430 
435  virtual unsigned int nVariables() const;
436 
443 
450 
454  void assignMaxVarNDofsPerElem(const size_t & max_dofs) { _max_var_n_dofs_per_elem = max_dofs; }
455 
459  void assignMaxVarNDofsPerNode(const size_t & max_dofs) { _max_var_n_dofs_per_node = max_dofs; }
460 
465  virtual void addVariableToZeroOnResidual(std::string var_name);
466 
471  virtual void addVariableToZeroOnJacobian(std::string var_name);
472 
479  virtual void zeroVariables(std::vector<std::string> & vars_to_be_zeroed);
480 
485  virtual void zeroVariablesForResidual();
486 
491  virtual void zeroVariablesForJacobian();
492 
497  virtual Order getMinQuadratureOrder();
498 
503  virtual void prepare(THREAD_ID tid);
504 
514  virtual void prepareFace(THREAD_ID tid, bool resize_data);
515 
520  virtual void prepareNeighbor(THREAD_ID tid);
521 
526  virtual void prepareLowerD(THREAD_ID tid);
527 
533  virtual void reinitElem(const Elem * elem, THREAD_ID tid);
534 
542  virtual void
543  reinitElemFace(const Elem * elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid);
544 
548  virtual void
549  reinitNeighborFace(const Elem * elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid);
550 
554  virtual void reinitNeighbor(const Elem * elem, THREAD_ID tid);
555 
559  virtual void reinitLowerD(THREAD_ID tid);
560 
566  virtual void reinitNode(const Node * node, THREAD_ID tid);
567 
574  virtual void reinitNodeFace(const Node * node, BoundaryID bnd_id, THREAD_ID tid);
575 
581  virtual void reinitNodes(const std::vector<dof_id_type> & nodes, THREAD_ID tid);
582 
588  virtual void reinitNodesNeighbor(const std::vector<dof_id_type> & nodes, THREAD_ID tid);
589 
594  virtual void reinitScalars(THREAD_ID tid);
595 
605  virtual void addVariableToCopy(const std::string & dest_name,
606  const std::string & source_name,
607  const std::string & timestep);
608 
609  const std::vector<MooseVariableFEBase *> & getVariables(THREAD_ID tid)
610  {
611  return _vars[tid].fieldVariables();
612  }
613 
614  const std::vector<MooseVariableScalar *> & getScalarVariables(THREAD_ID tid)
615  {
616  return _vars[tid].scalars();
617  }
618 
619  const std::set<SubdomainID> & getSubdomainsForVar(unsigned int var_number) const
620  {
621  return _var_map.at(var_number);
622  }
623 
627  virtual void removeVector(const std::string & name);
628 
642  virtual NumericVector<Number> &
643  addVector(const std::string & vector_name, const bool project, const ParallelType type);
644 
658  NumericVector<Number> & addVector(TagID tag, const bool project, const ParallelType type);
659 
663  virtual void closeTaggedVectors(const std::set<TagID> & tags);
664 
668  virtual void zeroTaggedVectors(const std::set<TagID> & tags);
669 
675  virtual void removeVector(TagID tag_id);
676 
682  virtual SparseMatrix<Number> & addMatrix(TagID /* tag */)
683  {
684  mooseError("Adding a matrix is not supported for this type of system!");
685  }
686 
692  virtual void removeMatrix(TagID /* tag */)
693  {
694  mooseError("Removing a matrix is not supported for this type of system!");
695  }
696 
697  virtual const std::string & name() const;
698 
705  virtual void addScalarVariable(const std::string & var_name,
706  Order order,
707  Real scale_factor,
708  const std::set<SubdomainID> * const active_subdomains = NULL);
709 
710  const std::vector<VariableName> & getVariableNames() const { return _vars[0].names(); }
711 
712  virtual void computeVariables(const NumericVector<Number> & /*soln*/) {}
713 
714  void copyVars(ExodusII_IO & io);
715 
719  virtual void copySolutionsBackwards();
720 
721  virtual void addTimeIntegrator(const std::string & /*type*/,
722  const std::string & /*name*/,
723  InputParameters /*parameters*/)
724  {
725  }
726 
727  virtual void addTimeIntegrator(std::shared_ptr<TimeIntegrator> /*ti*/) {}
728 
730  const TimeIntegrator * getTimeIntegrator() const { return _time_integrator.get(); }
731 
732  std::shared_ptr<TimeIntegrator> getSharedTimeIntegrator() { return _time_integrator; }
733 
734 protected:
736 
739 
742  std::string _name;
743 
745  std::vector<VariableWarehouse> _vars;
747  std::map<unsigned int, std::set<SubdomainID>> _var_map;
748 
749  std::vector<std::string> _vars_to_be_zeroed_on_residual;
750  std::vector<std::string> _vars_to_be_zeroed_on_jacobian;
751 
754 
756  std::vector<NumericVector<Number> *> _tagged_vectors;
758  std::vector<SparseMatrix<Number> *> _tagged_matrices;
760  std::vector<bool> _matrix_tag_active_flags;
761 
762  // Used for saving old solutions so that they wont be accidentally changed
763  NumericVector<Real> * _saved_old;
764  NumericVector<Real> * _saved_older;
765 
766  // Used for saving old u_dot and u_dotdot so that they wont be accidentally changed
767  NumericVector<Real> * _saved_dot_old;
768  NumericVector<Real> * _saved_dotdot_old;
769 
772 
773  std::vector<VarCopyInfo> _var_to_copy;
774 
777 
780 
782  std::shared_ptr<TimeIntegrator> _time_integrator;
783 };
784 
785 #define PARALLEL_TRY
786 
787 #define PARALLEL_CATCH _fe_problem.checkExceptionAndStopSolve();
788 
virtual const std::set< SubdomainID > * getVariableBlocks(unsigned int var_number)
Get the block where a variable of this system is defined.
Definition: SystemBase.C:168
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
Definition: SystemBase.C:805
virtual void reinitNode(const Node *node, THREAD_ID tid)
Reinit nodal assembly info.
Definition: SystemBase.C:372
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
virtual void initializeObjects()
Called only once, just before the solve begins so objects can do some precalculations.
Definition: SystemBase.h:132
virtual NumericVector< Number > * solutionUDot()=0
virtual const Number & duDotDu() const
Definition: SystemBase.h:170
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:784
virtual TagID systemMatrixTag()
Return the Matrix Tag ID for System.
Definition: SystemBase.C:721
virtual void reinitScalars(THREAD_ID tid)
Reinit scalar varaibles.
Definition: SystemBase.C:422
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.
Definition: SystemBase.C:345
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Definition: SystemBase.h:614
virtual void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
Definition: SystemBase.C:586
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
Definition: SystemBase.C:701
std::string _source_name
Definition: SystemBase.h:84
Class for stuff related to variables.
Definition: Adaptivity.h:29
virtual void copyOldSolutions()
Shifts the solutions backwards in time.
Definition: SystemBase.C:1052
virtual SparseMatrix< Number > & addMatrix(TagID)
Adds a jacobian sized vector.
Definition: SystemBase.h:682
virtual NumericVector< Number > & residualCopy()
Definition: SystemBase.h:320
unsigned int TagID
Definition: MooseTypes.h:162
virtual const SubProblem & subproblem() const
Definition: SystemBase.h:106
Generic factory class for build all sorts of objects.
Definition: Factory.h:153
virtual void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid)
Reinit assembly info for a side of an element.
Definition: SystemBase.C:334
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:542
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:207
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:749
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.
Definition: SystemBase.C:613
virtual NumericVector< Number > & solutionOld()=0
size_t getMaxVarNDofsPerElem() const
Gets the maximum number of dofs used by any one variable on any one element.
Definition: SystemBase.h:442
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
Definition: SystemBase.h:758
virtual void init()
Initialize the system.
Definition: SystemBase.h:127
virtual void reinitElem(const Elem *elem, THREAD_ID tid)
Reinit an element assembly info.
Definition: SystemBase.C:314
virtual void reinitLowerD(THREAD_ID tid)
Compute the values of the variables on the lower dimensional element.
Definition: SystemBase.C:364
size_t _max_var_n_dofs_per_node
Maximum number of dofs for any one variable on any one node.
Definition: SystemBase.h:779
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
Definition: SystemBase.C:773
virtual Order getMinQuadratureOrder()
Get minimal quadrature order needed for integrating variables in this system.
Definition: SystemBase.C:227
TimeIntegrator * getTimeIntegrator()
Definition: SystemBase.h:729
virtual const Number & duDotDotDu() const
Definition: SystemBase.h:171
void dataLoad(std::istream &stream, SystemBase &system_base, void *context)
IO Methods for restart, backup and restore.
Definition: SystemBase.C:66
Factory & _factory
Definition: SystemBase.h:738
Base class for MOOSE-based applications.
Definition: MooseApp.h:59
const std::vector< MooseVariableFEBase * > & getVariables(THREAD_ID tid)
Definition: SystemBase.h:609
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual NumericVector< Number > * solutionUDotDotOld()=0
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.
Definition: SystemBase.C:944
void assignMaxVarNDofsPerNode(const size_t &max_dofs)
assign the maximum node dofs
Definition: SystemBase.h:459
virtual void prepareFace(THREAD_ID tid, bool resize_data)
Prepare the system for use on sides.
Definition: SystemBase.C:265
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for a system (of equations)
Definition: SystemBase.h:92
virtual void reinitNodes(const std::vector< dof_id_type > &nodes, THREAD_ID tid)
Reinit variables at a set of nodes.
Definition: SystemBase.C:400
size_t _max_var_n_dofs_per_elem
Maximum number of dofs for any one variable on any one element.
Definition: SystemBase.h:776
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, THREAD_ID tid)
Reinit variables at a set of neighbor nodes.
Definition: SystemBase.C:411
NumericVector< Real > * _saved_older
Definition: SystemBase.h:764
virtual TagID nonTimeVectorTag()
Definition: SystemBase.C:728
virtual NumericVector< Number > * solutionPreviousNewton()=0
virtual void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:1020
virtual unsigned int nVariables() const
Get the number of variables in this system.
Definition: SystemBase.C:692
MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:105
virtual const std::string & name() const
Definition: SystemBase.C:1088
Real _du_dot_du
Definition: SystemBase.h:752
void closeTaggedMatrices(const std::set< TagID > &tags)
Close all matrices associated the tags.
Definition: SystemBase.C:827
virtual void deactiveAllMatrixTags()
Make matrices inactive.
Definition: SystemBase.C:886
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:773
virtual Number & duDotDu()
Definition: SystemBase.h:168
virtual DofMap & dofMap()
Gets writeable reference to the dof map.
Definition: SystemBase.C:932
void extraSparsity(SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz, void *context)
Free function used for a libMesh callback.
Definition: SystemBase.C:39
size_t getMaxVarNDofsPerNode() const
Gets the maximum number of dofs used by any one variable on any one node.
Definition: SystemBase.h:449
virtual TagID timeVectorTag()
Ideally, we should not need this API.
Definition: SystemBase.C:707
virtual Number & duDotDotDu()
Definition: SystemBase.h:169
virtual void disassociateAllTaggedVectors()
Disassociate all vectors, and then hasVector() will return false.
Definition: SystemBase.C:798
Real _du_dotdot_du
Definition: SystemBase.h:753
virtual void zeroVariablesForResidual()
Zero out the solution for the variables that were registered as needing to have their solutions zeroe...
Definition: SystemBase.C:215
void extraSendList(std::vector< dof_id_type > &send_list, void *context)
///< Type of coordinate system
Definition: SystemBase.C:31
virtual void disassociateAllTaggedMatrices()
Clear all tagged matrices.
Definition: SystemBase.C:919
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
Definition: SystemBase.h:760
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:750
boundary_id_type BoundaryID
virtual void addTimeIntegrator(const std::string &, const std::string &, InputParameters)
Definition: SystemBase.h:721
virtual void removeMatrix(TagID)
Removes a jacobian sized vector.
Definition: SystemBase.h:692
Information about variables that will be copied.
Definition: SystemBase.h:74
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:481
virtual void prepareNeighbor(THREAD_ID tid)
Prepare the system for use.
Definition: SystemBase.C:298
virtual ~SystemBase()
Definition: SystemBase.h:96
const std::vector< numeric_index_type > & n_nz
virtual void associateMatrixToTag(SparseMatrix< Number > &matrix, TagID tag)
associate a matirx to a tag
Definition: SystemBase.C:835
std::string _dest_name
Definition: SystemBase.h:83
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
SubProblem & _subproblem
Definition: SystemBase.h:735
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.
Moose::VarKindType _var_kind
default kind of variables in this system
Definition: SystemBase.h:771
virtual bool matrixTagActive(TagID tag) const
If or not a matrix tag is active.
Definition: SystemBase.C:911
NumericVector< Real > * _saved_dot_old
Definition: SystemBase.h:767
virtual SubProblem & subproblem()
Definition: SystemBase.h:105
virtual System & system()=0
Get the reference to the libMesh system.
virtual void activeAllMatrixTags()
Make all exsiting matrices ative.
Definition: SystemBase.C:897
virtual unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:926
std::string _timestep
Definition: SystemBase.h:85
void copyVars(ExodusII_IO &io)
Definition: SystemBase.C:952
VarCopyInfo(const std::string &dest_name, const std::string &source_name, const std::string &timestep)
Definition: SystemBase.h:76
virtual void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
Definition: SystemBase.C:576
virtual void reinitNeighbor(const Elem *elem, THREAD_ID tid)
Compute the values of the variables at all the current points.
Definition: SystemBase.C:356
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
Definition: SystemBase.C:668
void assignMaxVarNDofsPerElem(const size_t &max_dofs)
assign the maximum element dofs
Definition: SystemBase.h:454
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:747
virtual void copySolutionsBackwards()
Copy current solution into old and older.
Definition: SystemBase.C:1035
virtual NumericVector< Number > & serializedSolution()=0
Returns a reference to a serialized version of the solution vector for this subproblem.
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
disassociate a matirx from a tag
Definition: SystemBase.C:847
virtual void solve()
Solve the system (using libMesh magic)
Definition: SystemBase.C:1026
std::string _name
The name of this system.
Definition: SystemBase.h:742
MooseApp & _app
Definition: SystemBase.h:737
virtual void activeMatrixTag(TagID tag)
Active a matrix for tag.
Definition: SystemBase.C:862
virtual void saveOldSolutions()
Save the old and older solutions.
Definition: SystemBase.C:488
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:745
MatType type
virtual void addExtraVectors()
Method called during initialSetup to add extra system vector if they are required by the simulation...
Definition: SystemBase.C:1015
SystemBase(SubProblem &subproblem, const std::string &name, Moose::VarKindType var_kind)
Definition: SystemBase.C:82
std::shared_ptr< TimeIntegrator > getSharedTimeIntegrator()
Definition: SystemBase.h:732
Base class for time integrators.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:59
virtual void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Definition: SystemBase.C:1082
MooseMesh & _mesh
Definition: SystemBase.h:740
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:178
MooseVariableFE< T > & getFieldVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:136
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
Definition: SystemBase.C:811
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, THREAD_ID tid)
Reinit nodal assembly info on a face.
Definition: SystemBase.C:386
virtual void zeroVariablesForJacobian()
Zero out the solution for the variables that were registered as needing to have their solutions zeroe...
Definition: SystemBase.C:221
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Definition: SystemBase.h:782
virtual MooseMesh & mesh()
Definition: SystemBase.h:103
NumericVector< Real > * _saved_old
Definition: SystemBase.h:763
Class for scalar variables (they are different).
virtual NumericVector< Number > & solutionOlder()=0
virtual NumericVector< Number > & solution()=0
NumericVector< Real > * _saved_dotdot_old
Definition: SystemBase.h:768
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:710
virtual void prepare(THREAD_ID tid)
Prepare the system for use.
Definition: SystemBase.C:242
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:184
virtual const MooseMesh & mesh() const
Definition: SystemBase.h:104
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
Definition: SystemBase.h:619
virtual NumericVector< Number > * solutionUDotOld()=0
virtual NumericVector< Number > * solutionUDotDot()=0
virtual bool isScalarVariable(unsigned int var_name) const
Definition: SystemBase.C:686
virtual void computeVariables(const NumericVector< Number > &)
Definition: SystemBase.h:712
void dataStore(std::ostream &stream, SystemBase &system_base, void *context)
IO Methods for restart, backup and restore.
Definition: SystemBase.C:50
virtual void prepareLowerD(THREAD_ID tid)
Prepare the system for use for lower dimensional elements.
Definition: SystemBase.C:306
virtual void deactiveMatrixTag(TagID tag)
deactive a matrix for tag
Definition: SystemBase.C:874
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
Definition: SystemBase.h:756
virtual void addTimeIntegrator(std::shared_ptr< TimeIntegrator >)
Definition: SystemBase.h:727
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:677
MooseVariableFE< VectorValue< Real > > VectorMooseVariable
Definition: SystemBase.h:32
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:430
virtual NumericVector< Number > & residualGhosted()
Definition: SystemBase.h:324
MooseVariableFE< Real > MooseVariable
Definition: SystemBase.h:30
virtual void restoreSolutions()
Restore current solutions (call after your solve failed)
Definition: SystemBase.C:1068
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector.
Definition: SystemBase.C:751
virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a scalar variable with specified number.
Definition: SystemBase.C:149
virtual TagID residualVectorTag()
Definition: SystemBase.C:735
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:190
virtual void restoreOldSolutions()
Restore the old and older solutions when the saved solutions present.
Definition: SystemBase.C:513
virtual TagID timeMatrixTag()
Return the Matrix Tag ID for Time.
Definition: SystemBase.C:714
const std::vector< numeric_index_type > & n_oz
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.
Definition: SystemBase.C:644
unsigned int THREAD_ID
Definition: MooseTypes.h:161
const TimeIntegrator * getTimeIntegrator() const
Definition: SystemBase.h:730