Go to the documentation of this file.
22 #include "libmesh/exodusII_io.h"
23 #include "libmesh/parallel_object.h"
24 #include "libmesh/numeric_vector.h"
25 #include "libmesh/sparse_matrix.h"
52 void extraSendList(std::vector<dof_id_type> & send_list,
void * context);
58 std::vector<dof_id_type> &
n_nz,
59 std::vector<dof_id_type> &
n_oz,
80 const std::string & source_name,
81 const std::string & timestep)
105 virtual unsigned int number()
const;
147 virtual DofMap &
dofMap();
152 virtual const DofMap &
dofMap()
const;
157 virtual System &
system() = 0;
158 virtual const System &
system()
const = 0;
184 virtual void solve();
193 virtual const NumericVector<Number> *
const &
currentSolution()
const = 0;
195 virtual NumericVector<Number> &
solution() = 0;
199 virtual const NumericVector<Number> &
solution()
const = 0;
200 virtual const NumericVector<Number> &
solutionOld()
const = 0;
201 virtual const NumericVector<Number> &
solutionOlder()
const = 0;
215 virtual const NumericVector<Number> *
solutionUDot()
const = 0;
226 bool hasVector(
const std::string & tag_name)
const;
264 virtual NumericVector<Number> &
getVector(
const std::string &
name);
358 mooseError(
"This system does not support getting a copy of the residual");
362 mooseError(
"This system does not support getting a ghosted copy of the residual");
374 std::vector<dof_id_type> &
n_nz,
375 std::vector<dof_id_type> &
n_oz) = 0;
383 virtual void addVariable(
const std::string & var_type,
384 const std::string & var_name,
399 virtual bool hasVariable(
const std::string & var_name)
const;
430 template <
typename T>
440 template <
typename T>
467 virtual const std::set<SubdomainID> *
getVariableBlocks(
unsigned int var_number);
517 virtual void zeroVariables(std::vector<std::string> & vars_to_be_zeroed);
646 const std::string & source_name,
647 const std::string & timestep);
651 return _vars[tid].fieldVariables();
656 return _vars[tid].scalars();
682 virtual NumericVector<Number> &
683 addVector(
const std::string & vector_name,
const bool project,
const ParallelType
type);
698 NumericVector<Number> &
addVector(
TagID tag,
const bool project,
const ParallelType
type);
724 mooseError(
"Adding a matrix is not supported for this type of system!");
734 mooseError(
"Removing a matrix is not supported for this type of system!");
737 virtual const std::string &
name()
const;
756 const std::string & ,
779 std::vector<VariableWarehouse>
_vars;
781 std::map<unsigned int, std::set<SubdomainID>>
_var_map;
835 #define PARALLEL_CATCH _fe_problem.checkExceptionAndStopSolve();
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
virtual void addVariableToCopy(const std::string &dest_name, const std::string &source_name, const std::string ×tep)
Add info about variable that will be copied.
virtual NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
virtual MooseMesh & mesh()
MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
virtual void reinitNode(const Node *node, THREAD_ID tid)
Reinit nodal assembly info.
NumericVector< Real > * _saved_dotdot_old
virtual void activeMatrixTag(TagID tag)
Active a matrix for tag.
virtual TagID residualVectorTag()
void closeTaggedMatrices(const std::set< TagID > &tags)
Close all matrices associated the tags.
size_t _max_var_n_dofs_per_elem
Maximum number of dofs for any one variable on any one element.
MooseObjectWarehouseBase< MooseVariableBase > _variable_warehouse
Storage for MooseVariable objects.
virtual const Number & duDotDu() const
virtual TagID nonTimeVectorTag()
virtual void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Class for scalar variables (they are different).
virtual NumericVector< Number > * solutionPreviousNewton()=0
virtual const Number & duDotDotDu() const
bool _computing_scaling_jacobian
Flag used to indicate whether we are computing the scaling Jacobian.
virtual void update()
Update the system (doing libMesh magic)
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
virtual void addVariableToZeroOnJacobian(std::string var_name)
Adds this variable to the list of variables to be zeroed during each Jacobian evaluation.
virtual DofMap & dofMap()
Gets writeable reference to the dof map.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
virtual Order getMinQuadratureOrder()
Get minimal quadrature order needed for integrating variables in this system.
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
virtual void reinitNodes(const std::vector< dof_id_type > &nodes, THREAD_ID tid)
Reinit variables at a set of nodes.
NumericVector< Real > * _saved_older
virtual Number & duDotDotDu()
const std::vector< MooseVariableFEBase * > & getVariables(THREAD_ID tid)
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
virtual void copyOldSolutions()
Shifts the solutions backwards in time.
virtual void disassociateAllTaggedVectors()
Disassociate all vectors, and then hasVector() will return false.
virtual void deactiveMatrixTag(TagID tag)
deactive a matrix for tag
void computingScalingResidual(bool computing_scaling_residual)
Setter for whether we're computing the scaling residual.
virtual void removeMatrix(TagID)
Removes a jacobian sized vector.
virtual System & system()=0
Get the reference to the libMesh system.
virtual NumericVector< Number > * solutionUDotDotOld()=0
Base class for time integrators.
virtual void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid)
Reinit assembly info for a side of an element.
virtual void reinitNeighbor(const Elem *elem, THREAD_ID tid)
Compute the values of the variables at all the current points.
virtual unsigned int nVariables() const
Get the number of variables in this system.
virtual NumericVector< Number > & residualGhosted()
Information about variables that will be copied.
virtual bool matrixTagActive(TagID tag) const
If or not a matrix tag is active.
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
std::vector< std::string > _vars_to_be_zeroed_on_residual
std::vector< VarCopyInfo > _var_to_copy
virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a scalar variable with specified number.
MooseVariableFE< VectorValue< Real > > VectorMooseVariable
virtual TagID timeMatrixTag()
Return the Matrix Tag ID for Time.
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
virtual TagID systemMatrixTag()
Return the Matrix Tag ID for System.
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, THREAD_ID tid)
Reinit variables at a set of neighbor nodes.
const TimeIntegrator * getTimeIntegrator() const
virtual void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
SystemBase(SubProblem &subproblem, const std::string &name, Moose::VarKindType var_kind)
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters ¶meters)
Canonical method for adding a variable.
virtual const SubProblem & subproblem() const
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
void assignMaxVarNDofsPerNode(std::size_t max_dofs)
assign the maximum node dofs
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.
virtual TagID timeVectorTag()
Ideally, we should not need this API.
std::string _name
The name of this system.
virtual NumericVector< Number > & solution()=0
virtual NumericVector< Number > & solutionOlder()=0
virtual NumericVector< Number > & solutionOld()=0
virtual bool isArrayVariable(const std::string &var_name) const
If a variable is an array variable.
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.
std::shared_ptr< TimeIntegrator > getSharedTimeIntegrator()
NumericVector< Real > * _saved_dot_old
virtual SubProblem & subproblem()
std::vector< std::vector< MooseVariableFEBase * > > _numbered_vars
Map variable number to its pointer.
virtual SparseMatrix< Number > & addMatrix(TagID)
Adds a jacobian sized vector.
Generic class for solving transient nonlinear problems.
virtual void zeroVariablesForResidual()
Zero out the solution for the variables that were registered as needing to have their solutions zeroe...
virtual NumericVector< Number > & residualCopy()
virtual NumericVector< Number > * solutionUDotDot()=0
size_t _max_var_n_dofs_per_node
Maximum number of dofs for any one variable on any one node.
virtual void addVariableToZeroOnResidual(std::string var_name)
Adds this variable to the list of variables to be zeroed during each residual evaluation.
virtual void prepareLowerD(THREAD_ID tid)
Prepare the system for use for lower dimensional elements.
const std::vector< numeric_index_type > & n_nz
virtual void init()
Initialize the system.
virtual void disassociateAllTaggedMatrices()
Clear all tagged matrices.
bool computingScalingJacobian() const
Whether we are computing an initial Jacobian for automatic variable scaling.
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
const std::vector< VariableName > & getVariableNames() const
virtual bool hasScalarVariable(const std::string &var_name) const
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
disassociate a matirx from a tag
virtual void deactiveAllMatrixTags()
Make matrices inactive.
virtual NumericVector< Number > & serializedSolution()=0
Returns a reference to a serialized version of the solution vector for this subproblem.
virtual Number & duDotDu()
virtual void prepareNeighbor(THREAD_ID tid)
Prepare the system for use.
virtual void prepareFace(THREAD_ID tid, bool resize_data)
Prepare the system for use on sides.
virtual void restoreSolutions()
Restore current solutions (call after your solve failed)
boundary_id_type BoundaryID
virtual bool isScalarVariable(unsigned int var_name) const
virtual unsigned int number() const
Gets the number of this system.
virtual void activeAllMatrixTags()
Make all exsiting matrices ative.
std::size_t getMaxVarNDofsPerNode() const
Gets the maximum number of dofs used by any one variable on any one node.
Generic factory class for build all sorts of objects.
bool _computing_scaling_residual
Flag used to indicate whether we are computing the scaling Residual.
NumericVector< Real > * _saved_old
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector.
virtual void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
std::size_t getMaxVarNDofsPerElem() const
Gets the maximum number of dofs used by any one variable on any one element.
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
Moose::VarKindType _var_kind
default kind of variables in this system
virtual void zeroVariables(std::vector< std::string > &vars_to_be_zeroed)
Zero out the solution for the list of variables passed in.
virtual void restoreOldSolutions()
Restore the old and older solutions when the saved solutions present.
virtual const MooseMesh & mesh() const
virtual void prepare(THREAD_ID tid)
Prepare the system for use.
void assignMaxVarNDofsPerElem(std::size_t max_dofs)
assign the maximum element dofs
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
virtual void solve()
Solve the system (using libMesh magic)
virtual void saveOldSolutions()
Save the old and older solutions.
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, THREAD_ID tid)
Reinit nodal assembly info on a face.
virtual void zeroVariablesForJacobian()
Zero out the solution for the variables that were registered as needing to have their solutions zeroe...
void dataLoad(std::istream &stream, SystemBase &system_base, void *context)
IO Methods for restart, backup and restore.
virtual void computeVariables(const NumericVector< Number > &)
void dataStore(std::ostream &stream, SystemBase &system_base, void *context)
IO Methods for restart, backup and restore.
VarKindType
Framework-wide stuff.
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
virtual const std::set< SubdomainID > * getVariableBlocks(unsigned int var_number)
Get the block where a variable of this system is defined.
virtual void copySolutionsBackwards()
Copy current solution into old and older.
virtual const std::string & name() const
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.
MooseVariableFE< T > & getFieldVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Base class for a system (of equations)
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
virtual void associateMatrixToTag(SparseMatrix< Number > &matrix, TagID tag)
associate a matirx to a tag
Base class for MOOSE-based applications.
MooseVariableFE< Real > MooseVariable
unsigned int _max_var_number
Maximum variable number.
virtual void addTimeIntegrator(const std::string &, const std::string &, InputParameters &)
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.
VarCopyInfo(const std::string &dest_name, const std::string &source_name, const std::string ×tep)
virtual void addTimeIntegrator(std::shared_ptr< TimeIntegrator >)
unsigned int getMaxVariableNumber() const
Returns the maximum number of all variables on the system.
void copyVars(ExodusII_IO &io)
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
virtual void reinitScalars(THREAD_ID tid, bool reinit_for_derivative_reordering=false)
Reinit scalar varaibles.
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
void computingScalingJacobian(bool computing_scaling_jacobian)
Setter for whether we're computing the scaling jacobian.
bool computingScalingResidual() const
Whether we are computing an initial Residual for automatic variable scaling.
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
virtual void reinitLowerD(THREAD_ID tid)
Compute the values of the variables on the lower dimensional element.
virtual void initializeObjects()
Called only once, just before the solve begins so objects can do some precalculations.
virtual void reinitElem(const Elem *elem, THREAD_ID tid)
Reinit an element assembly info.
virtual NumericVector< Number > * solutionUDot()=0
virtual NumericVector< Number > * solutionUDotOld()=0
Class for stuff related to variables.
void extraSendList(std::vector< dof_id_type > &send_list, void *context)
///< Type of coordinate system
virtual void addExtraVectors()
Method called during initialSetup to add extra system vector if they are required by the simulation.
TimeIntegrator * getTimeIntegrator()
void applyScalingFactors(const std::vector< Real > &inverse_scaling_factors)
Applies scaling factors to the system's variables.
const std::vector< numeric_index_type > & n_oz