29 #include "libmesh/dof_map.h" 30 #include "libmesh/string_to_enum.h" 43 std::vector<dof_id_type> & n_nz,
44 std::vector<dof_id_type> & n_oz,
52 const std::string & name,
54 :
libMesh::ParallelObject(subproblem),
56 _subproblem(subproblem),
57 _app(subproblem.getMooseApp()),
58 _factory(_app.getFactory()),
59 _mesh(subproblem.
mesh()),
67 _saved_dotdot_old(NULL),
69 _max_var_n_dofs_per_elem(0),
70 _max_var_n_dofs_per_node(0),
71 _time_integrator(nullptr),
72 _automatic_scaling(false),
74 _solution_states_initialized(false)
84 mooseError(
"Variable '", var_name,
"' does not exist in this system");
102 return *
_vars[tid].getFieldVariable<T>(var_name);
105 template <
typename T>
109 return *
_vars[tid].getActualFieldVariable<T>(var_name);
112 template <
typename T>
116 return *
_vars[tid].getFVVariable<T>(var_name);
119 template <
typename T>
123 return *
_vars[tid].getFieldVariable<T>(var_number);
126 template <
typename T>
130 return *
_vars[tid].getActualFieldVariable<T>(var_number);
138 mooseError(
"Scalar variable '" + var_name +
"' does not exist in this system");
152 const std::set<SubdomainID> *
155 mooseAssert(
_var_map.find(var_number) !=
_var_map.end(),
"Variable does not exist.");
179 Threads::parallel_reduce(elem_range, aldit);
182 aldit.dofIndicesSetUnion();
184 const auto & all_dof_indices = aldit.getDofIndices();
191 if (vars_to_be_zeroed.size() > 0)
197 mooseError(
"System needs to be registered in FEProblemBase for using zeroVariables.");
201 Threads::parallel_reduce(elem_range, aldit);
207 for (
const auto & dof : dof_indices_to_zero)
233 const std::vector<MooseVariableFieldBase *> & vars =
_vars[0].fieldVariables();
234 for (
const auto & var : vars)
236 FEType fe_type = var->feType();
237 if (fe_type.default_quadrature_order() > order)
238 order = fe_type.default_quadrature_order();
249 const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
251 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
252 for (
const auto & var : vars)
253 var->clearDofIndices();
255 for (
const auto & var : active_elemental_moose_variables)
256 if (&(var->sys()) ==
this)
261 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
262 for (
const auto & var : vars)
273 const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
276 std::vector<MooseVariableFieldBase *> newly_prepared_vars;
278 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
279 for (
const auto & var : vars)
281 mooseAssert(&var->sys() ==
this,
282 "I will cry if we store variables in our warehouse that don't belong to us");
294 if (!active_elemental_moose_variables.count(var))
297 newly_prepared_vars.push_back(var);
303 for (
const auto var_ptr : newly_prepared_vars)
315 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
316 for (
const auto & var : vars)
317 var->prepareNeighbor();
323 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
324 for (
const auto & var : vars)
325 var->prepareLowerD();
334 const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
336 for (
const auto & var : active_elemental_moose_variables)
337 if (&(var->sys()) ==
this)
338 var->computeElemValues();
342 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
343 for (
const auto & var : vars)
344 var->computeElemValues();
354 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
355 for (
const auto & var : vars)
356 var->computeElemValuesFace();
365 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
366 for (
const auto & var : vars)
367 var->computeNeighborValuesFace();
373 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
374 for (
const auto & var : vars)
375 var->computeNeighborValues();
381 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
382 for (
const auto & var : vars)
383 var->computeLowerDValues();
389 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
390 for (
const auto & var : vars)
393 if (var->isNodalDefined())
394 var->computeNodalValues();
401 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
402 for (
const auto & var : vars)
405 if (var->isNodalDefined())
406 var->computeNodalValues();
413 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
414 for (
const auto & var : vars)
416 var->reinitNodes(nodes);
417 var->computeNodalValues();
424 const std::vector<MooseVariableFieldBase *> & vars =
_vars[tid].fieldVariables();
425 for (
const auto & var : vars)
427 var->reinitNodesNeighbor(nodes);
428 var->computeNodalNeighborValues();
435 const std::vector<MooseVariableScalar *> & vars =
_vars[tid].scalars();
436 for (
const auto & var : vars)
437 var->reinit(reinit_for_derivative_reordering);
445 DofMap & dof_map =
dofMap();
447 std::vector<dof_id_type> dof_indices;
451 unsigned int sys_num = sys.number();
453 unsigned int n_vars = sys.n_vars();
455 for (
const auto & elem_id : ghosted_elems)
461 dof_map.dof_indices(elem, dof_indices);
464 for (
const auto & dof : dof_indices)
465 if (dof < dof_map.first_dof() || dof >= dof_map.end_dof())
466 send_list.push_back(dof);
471 for (
unsigned int n = 0; n < elem->n_nodes(); n++)
473 Node * node = elem->node_ptr(n);
476 for (
unsigned int v = 0; v <
n_vars; v++)
478 const Variable & var = sys.variable(v);
479 unsigned int var_num = var.number();
480 unsigned int n_comp = var.n_components();
483 if (node->n_dofs(sys_num, var_num) > 0)
486 for (
unsigned int c = 0; c < n_comp; c++)
487 send_list.push_back(node->dof_number(sys_num, var_num, c));
506 for (
unsigned int i = 1; i <= states - 1; ++i)
511 for (
unsigned int i = 1; i <= states - 1; ++i)
536 for (
unsigned int i = 1; i <= states - 1; ++i)
540 removeVector(
"save_solution_state_" + std::to_string(i));
562 mooseError(
"Cannot add tagged matrix with TagID ",
566 "' because the tag does not exist in the problem");
582 mooseError(
"Cannot remove the matrix with TagID ",
586 "', because that tag does not exist in the problem");
591 system().remove_matrix(matrix_name);
610 mooseError(
"Cannot add tagged vector with TagID ",
614 "' because the tag does not exist in the problem");
620 if (type != ParallelType::AUTOMATIC && vec.type() != type)
625 "' because a vector with the same name was found with a different parallel type");
645 "' because that tag does not exist in the problem");
647 mooseError(
"Cannot close vector tag with name '",
651 "' because there is no vector associated with that tag");
659 for (
const auto tag : tags)
671 "' because that tag does not exist in the problem");
673 mooseError(
"Cannot zero vector tag with name '",
677 "' because there is no vector associated with that tag");
685 for (
const auto tag : tags)
693 mooseError(
"Cannot remove the vector with TagID ",
697 "', because that tag does not exist in the problem");
702 system().remove_vector(vector_name);
709 const std::string & name,
714 auto components = parameters.
get<
unsigned int>(
"components");
718 std::set<SubdomainID> blocks;
719 const auto & block_param = parameters.
get<std::vector<SubdomainName>>(
"block");
720 for (
const auto & subdomain_name : block_param)
723 blocks.insert(blk_id);
726 auto fe_type = FEType(Utility::string_to_enum<Order>(parameters.
get<
MooseEnum>(
"order")),
727 Utility::string_to_enum<FEFamily>(parameters.
get<
MooseEnum>(
"family")));
729 unsigned int var_num;
731 if (var_type ==
"ArrayMooseVariable")
735 mooseError(
"Vector family type cannot be used in an array variable");
738 std::vector<std::string> var_names;
739 for (
unsigned int i = 0; i < components; i++)
744 var_num =
system().add_variables(var_names, fe_type, &blocks) - (components - 1);
750 "' is an array variable ('components' > 1) but 'array' is set to false.");
751 parameters.
set<
bool>(
"array") =
true;
754 var_num =
system().add_variable(
name, fe_type, &blocks);
756 parameters.
set<
unsigned int>(
"_var_num") = var_num;
762 std::shared_ptr<MooseVariableBase> var =
767 if (
auto fe_var = dynamic_cast<MooseVariableFieldBase *>(var.get()))
769 auto required_size = var_num + components;
772 for (MooseIndex(components) component = 0; component < components; ++component)
785 if (var->blockRestricted())
787 for (MooseIndex(components) component = 0; component < components; ++component)
788 _var_map[var_num + component].insert(
id);
790 for (MooseIndex(components) component = 0; component < components; ++component)
791 _var_map[var_num + component] = std::set<SubdomainID>();
803 if (
system().has_variable(var_name))
804 return system().variable_type(var_name).family !=
SCALAR;
805 if (std::find(names.begin(), names.end(), var_name) != names.end())
816 if (!
system().has_variable(var_name) &&
817 std::find(names.begin(), names.end(), var_name) != names.end())
827 if (
system().has_variable(var_name))
828 return system().variable_type(var_name).family ==
SCALAR;
836 return (
system().variable(var_num).type().family ==
SCALAR);
843 n +=
_vars[0].scalars().size();
852 for (
auto & var :
_vars[0].fieldVariables())
862 for (
auto & var :
_vars[0].fieldVariables())
899 mooseError(
"Cannot retreive vector with tag ", tag,
" because that tag does not exist");
901 mooseError(
"Cannot retreive vector with tag ",
905 "'\nbecause a vector has not been associated with that tag.");
917 mooseError(
"Cannot retreive vector with tag ", tag,
" because that tag does not exist");
919 mooseError(
"Cannot retreive vector with tag ",
923 "'\nbecause a vector has not been associated with that tag.");
933 mooseError(
"Cannot associate vector to tag ", tag,
" because that tag does not exist");
945 mooseError(
"Cannot disassociate vector from tag ", tag,
" because that tag does not exist");
947 mooseError(
"You can not disassociate a vector from a tag which it was not associated to");
956 mooseError(
"Cannot disassociate vector from tag ", tag,
" because that tag does not exist");
967 for (
const auto tag : tags)
978 mooseError(
"Cannot retreive matrix with tag ", tag,
" because that tag does not exist");
980 mooseError(
"Cannot retreive matrix with tag ",
984 "'\nbecause a matrix has not been associated with that tag.");
996 mooseError(
"Cannot retreive matrix with tag ", tag,
" because that tag does not exist");
998 mooseError(
"Cannot retreive matrix with tag ",
1002 "'\nbecause a matrix has not been associated with that tag.");
1011 for (
auto tag : tags)
1019 for (
auto tag : tags)
1028 mooseError(
"Cannot associate matrix to tag ", tag,
" because that tag does not exist");
1040 mooseError(
"Cannot disassociate matrix from tag ", tag,
" because that tag does not exist");
1042 mooseError(
"You can not disassociate a matrix from a tag which it was not associated to");
1051 mooseError(
"Cannot disassociate matrix from tag ", tag,
" because that tag does not exist");
1062 for (
const auto tag : tags)
1071 "Cannot active Matrix with matrix_tag : " << tag <<
"that does not exist");
1083 "Cannot deactivate Matrix with matrix_tag : " << tag <<
"that does not exist");
1098 for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1109 for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1127 return system().number();
1133 return system().get_dof_map();
1139 return system().get_dof_map();
1144 const std::string & source_name,
1145 const std::string & timestep)
1153 int n_steps = io.get_num_time_steps();
1155 bool did_copy =
false;
1160 if (vci._timestep ==
"LATEST")
1166 if (timestep > n_steps)
1167 mooseError(
"Invalid value passed as \"initial_from_file_timestep\". Expected \"LATEST\" or " 1168 "a valid integer between 1 and ",
1170 " inclusive, received ",
1178 const auto & var =
getVariable(0, vci._dest_name);
1181 const auto & array_var = getFieldVariable<RealEigenVector>(0, vci._dest_name);
1182 for (MooseIndex(var.count()) i = 0; i < var.count(); ++i)
1185 const auto system_var = array_var.componentName(i);
1187 io.copy_nodal_solution(
system(), exodus_var, system_var, timestep);
1189 io.copy_elemental_solution(
system(), exodus_var, system_var, timestep);
1195 io.copy_nodal_solution(
system(), vci._dest_name, vci._source_name, timestep);
1197 io.copy_elemental_solution(
system(), vci._dest_name, vci._source_name, timestep);
1201 io.copy_scalar_solution(
system(), {vci._dest_name}, {vci._source_name}, timestep);
1203 mooseError(
"Unrecognized variable ", vci._dest_name,
" in variables to copy.");
1213 if (update_libmesh_system)
1237 for (
unsigned int i = states - 1; i > 0; --i)
1259 for (
unsigned int i = states - 1; i > 0; --i)
1277 mooseError(
"Cannot restore solutions without old solution");
1324 unsigned int state = 0;
1328 state =
std::max(state, var->oldestSolutionStateRequested());
1330 state =
std::max(state, var->oldestSolutionStateRequested());
1341 mooseAssert(state != 0,
"Not an old state");
1347 else if (state == 2)
1353 return "solution_state_" + std::to_string(state) +
"_" +
Moose::stringify(iteration_type);
1363 "': solution state ",
1365 " was requested in ",
1367 " but only up to state ",
1371 const auto & solution_states =
_solution_states[
static_cast<unsigned short>(iteration_type)];
1374 mooseAssert(solution_states[0] == &
solutionInternal(),
"Inconsistent current solution");
1376 mooseAssert(solution_states[state] ==
1378 "Inconsistent solution state");
1380 return *solution_states[state];
1389 return *
_solution_states[
static_cast<unsigned short>(iteration_type)][state];
1396 libmesh_parallel_only(this->
comm());
1401 auto & solution_states =
_solution_states[
static_cast<unsigned short>(iteration_type)];
1402 solution_states.resize(state + 1);
1405 if (!solution_states[0])
1408 mooseAssert(solution_states[0] == &
solutionInternal(),
"Inconsistent current solution");
1411 for (
unsigned int i = 1; i <= state; ++i)
1412 if (!solution_states[i])
1420 "Inconsistent solution state");
1426 for (MooseIndex(
_vars) thread = 0; thread <
_vars.size(); ++thread)
1428 auto & field_variables =
_vars[thread].fieldVariables();
1429 for (MooseIndex(field_variables) i = 0, p = 0; i < field_variables.size(); ++i)
1431 auto factors = field_variables[i]->arrayScalingFactor();
1432 for (
unsigned int j = 0; j < field_variables[i]->count(); ++j, ++p)
1433 factors[j] /= inverse_scaling_factors[p];
1435 field_variables[i]->scalingFactor(factors);
1438 auto offset = field_variables.size();
1440 auto & scalar_variables =
_vars[thread].scalars();
1441 for (MooseIndex(scalar_variables) i = 0; i < scalar_variables.size(); ++i)
1442 scalar_variables[i]->scalingFactor(
1443 {1. / inverse_scaling_factors[offset + i] * scalar_variables[i]->scalingFactor()});
1447 _console <<
"Automatic scaling factors:\n";
1453 for (
const auto & field_variable : field_variables)
1455 const auto & factors = field_variable->arrayScalingFactor();
1456 _console <<
" " << field_variable->name() <<
":";
1457 for (
const auto i :
make_range(field_variable->count()))
1461 for (
const auto & scalar_variable : scalar_variables)
1462 _console <<
" " << scalar_variable->name() <<
": " << scalar_variable->scalingFactor()
1476 addVector(
"scaling_factors",
false, libMesh::ParallelType::GHOSTED);
1531 for (
auto & var_warehouse :
_vars)
1532 var_warehouse.clearAllDofIndices();
1538 _vars[tid].setActiveVariableCoupleableVectorTags(vtags);
1545 _vars[tid].setActiveScalarVariableCoupleableVectorTags(vtags);
1549 const std::string & var_name);
1552 SystemBase::getFieldVariable<RealVectorValue>(
THREAD_ID tid,
const std::string & var_name);
1555 SystemBase::getFieldVariable<RealEigenVector>(
THREAD_ID tid,
const std::string & var_name);
1558 unsigned int var_number);
1561 SystemBase::getFieldVariable<RealVectorValue>(
THREAD_ID tid,
unsigned int var_number);
1564 SystemBase::getFieldVariable<RealEigenVector>(
THREAD_ID tid,
unsigned int var_number);
1567 SystemBase::getActualFieldVariable<Real>(
THREAD_ID tid,
const std::string & var_name);
1570 SystemBase::getActualFieldVariable<RealVectorValue>(
THREAD_ID tid,
const std::string & var_name);
1573 SystemBase::getActualFieldVariable<RealEigenVector>(
THREAD_ID tid,
const std::string & var_name);
1576 SystemBase::getActualFieldVariable<Real>(
THREAD_ID tid,
unsigned int var_number);
1579 SystemBase::getActualFieldVariable<RealVectorValue>(
THREAD_ID tid,
unsigned int var_number);
1582 SystemBase::getActualFieldVariable<RealEigenVector>(
THREAD_ID tid,
unsigned int var_number);
1585 const std::string & var_name);
std::string name(const ElemQuality q)
void zeroTaggedVector(const TagID tag)
Zero vector with the given tag.
virtual void update(bool update_libmesh_system=true)
Update the system (doing libMesh magic)
virtual const std::set< SubdomainID > * getVariableBlocks(unsigned int var_number)
Get the block where a variable of this system is defined.
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Registers that the solution state state is needed.
virtual void reinitNode(const Node *node, THREAD_ID tid)
Reinit nodal assembly info.
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)
void closeTaggedVector(const TagID tag)
Close vector with the given tag.
virtual const NumericVector< Number > *const & currentSolution() const =0
The solution vector that is currently being operated on.
std::vector< std::vector< MooseVariableFieldBase * > > _numbered_vars
Map variable number to its pointer.
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
virtual NumericVector< Number > * solutionUDot()=0
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
std::vector< dof_id_type > _var_all_dof_indices
Container for the dof indices of a given variable.
virtual NumericVector< Number > & solutionInternal() const =0
Internal getter for solution owned by libMesh.
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.
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
void zeroTaggedVectors(const std::set< TagID > &tags)
Zero all vectors for given tags.
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
void applyScalingFactors(const std::vector< Real > &inverse_scaling_factors)
Applies scaling factors to the system's variables.
virtual void copyOldSolutions()
Shifts the solutions backwards in time.
bool _solution_states_initialized
Whether or not the solution states have been initialized.
virtual Elem * elemPtr(const dof_id_type i)
NumericVector< Number > & solution()
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters ¶meters)
Canonical method for adding a variable.
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 bool computingScalingJacobian() const =0
Getter for whether we're computing the scaling jacobian.
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
const TagName OLDER_SOLUTION_TAG
std::vector< std::string > _vars_to_be_zeroed_on_residual
std::vector< SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
std::ios_base::fmtflags flags() const
Return the current flags.
virtual void initSolutionState()
Initializes the solution state.
virtual void disassociateDefaultVectorTags()
Disassociate the vectors associated with the default vector tags of this system.
virtual void reinitElem(const Elem *elem, THREAD_ID tid)
Reinit an element assembly info.
virtual void reinitLowerD(THREAD_ID tid)
Compute the values of the variables on the lower dimensional element.
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
virtual const std::set< MooseVariableFieldBase * > & getActiveElementalMooseVariables(const THREAD_ID tid) const
Get the MOOSE variables to be reinited on each element.
virtual void associateVectorToTag(NumericVector< Number > &vec, TagID tag)
Associate a vector for a given tag.
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters ¶meters, THREAD_ID tid=0, bool print_deprecated=true)
virtual Order getMinQuadratureOrder()
Get minimal quadrature order needed for integrating variables in this system.
void addFunctor(const std::string &name, const Moose::FunctorBase< T > &functor, const THREAD_ID tid)
add a functor to the problem functor container
virtual NumericVector< Number > & solutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time)
Get a state of the solution (0 = current, 1 = old, 2 = older, etc).
bool computingScalingJacobian() const
Whether we are computing an initial Jacobian for automatic variable scaling.
const Parallel::Communicator & comm() const
virtual NumericVector< Number > * solutionUDotDotOld()=0
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 bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
void removeMatrix(TagID tag)
Removes a matrix with a given tag.
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual void prepareFace(THREAD_ID tid, bool resize_data)
Prepare the system for use on sides.
void addScalingVector()
Add the scaling factor vector to the system.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
void setActiveVariableCoupleableVectorTags(const std::set< TagID > &vtags, THREAD_ID tid)
Set the active vector tags for the variables.
Base class for a system (of equations)
virtual bool isArrayVariable(const std::string &var_name) const
If a variable is an array variable.
virtual void reinitNodes(const std::vector< dof_id_type > &nodes, THREAD_ID tid)
Reinit variables at a set of nodes.
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, THREAD_ID tid)
Reinit variables at a set of neighbor nodes.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
MooseVariableFV< T > & getFVVariable(THREAD_ID tid, const std::string &var_name)
Return a finite volume variable.
const std::set< dof_id_type > & getDofIndices() const
auto max(const L &left, const R &right)
virtual unsigned int nVariables() const
Get the number of variables in this system.
void setActiveScalarVariableCoupleableVectorTags(const std::set< TagID > &vtags, THREAD_ID tid)
Set the active vector tags for the scalar variables.
Grab all the (possibly semi)local dof indices for the variables passed in, in the system passed in...
virtual const std::string & name() const
virtual void jacobianSetup()
void unsetf(std::ios_base::fmtflags mask) const
Unset format flags.
void closeTaggedMatrices(const std::set< TagID > &tags)
Close all matrices associated the tags.
virtual void deactiveAllMatrixTags()
Make matrices inactive.
std::vector< VarCopyInfo > _var_to_copy
virtual DofMap & dofMap()
Gets writeable reference to the dof map.
int convert< int >(const std::string &str, bool throw_on_failure)
const TagName OLD_SOLUTION_TAG
virtual void zeroVariablesForResidual()
Zero out the solution for the variables that were registered as needing to have their solutions zeroe...
std::vector< bool > _matrix_tag_active_flags
Active flags for tagged matrices.
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
boundary_id_type BoundaryID
Information about variables that will be copied.
void hasScalingVector(const unsigned int nl_sys_num)
Tells this problem that the assembly associated with the given nonlinear system number involves a sca...
VarKindType
Framework-wide stuff.
virtual void prepareNeighbor(THREAD_ID tid)
Prepare the system for use.
An inteface for the _console for outputting to the Console object.
virtual void reinitScalars(THREAD_ID tid, bool reinit_for_derivative_reordering=false)
Reinit scalar varaibles.
virtual void associateMatrixToTag(SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
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 bool matrixTagActive(TagID tag) const
If or not a matrix tag is active.
virtual bool checkNonlocalCouplingRequirement()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
SparseMatrix< Number > & addMatrix(TagID tag)
Adds a matrix with a given tag.
virtual std::set< dof_id_type > & ghostedElems()
Return the list of elements that should have their DoFs ghosted to this processor.
NumericVector< Real > * _saved_dot_old
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
virtual bool hasSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time) const
Whether or not the system has the solution state (0 = current, 1 = old, 2 = older, etc).
virtual System & system()=0
Get the reference to the libMesh system.
virtual void activeAllMatrixTags()
Make all exsiting matrices ative.
unsigned int number() const
Gets the number of this system.
std::string stringify(const T &t)
conversion to string
void copyVars(ExodusII_IO &io)
void closeTaggedVectors(const std::set< TagID > &tags)
Close all vectors for given tags.
virtual void reinitNeighbor(const Elem *elem, THREAD_ID tid)
Compute the values of the variables at all the current points.
void extraSendList(std::vector< dof_id_type > &send_list, void *context)
Free function used for a libMesh callback.
std::streamsize precision() const
Return the current precision.
virtual bool hasVariable(const std::string &var_name) const
Query a system for a variable.
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
virtual void copySolutionsBackwards()
Copy current solution into old and older.
virtual std::set< TagID > defaultMatrixTags() const
Get the default matrix tags associted with this system.
virtual void disassociateMatrixFromTag(SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
virtual void solve()
Solve the system (using libMesh magic)
virtual unsigned int numMatrixTags() const
The total number of tags.
virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a scalar variable with specified number.
virtual void activeMatrixTag(TagID tag)
Active a matrix for tag.
virtual void saveOldSolutions()
Save the old and older solutions.
static std::string arrayVariableComponent(const std::string &var_name, unsigned int i)
Returns the variable name of a component of an array variable.
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
SystemBase(SubProblem &subproblem, const std::string &name, Moose::VarKindType var_kind)
virtual void subdomainSetup()
Generic class for solving transient nonlinear problems.
bool _verbose
True if printing out additional information.
void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Class for containing MooseEnum item information.
unsigned int nFVVariables() const
Get the number of finite volume variables in this system.
virtual void addVariableToZeroOnResidual(std::string var_name)
Adds this variable to the list of variables to be zeroed during each residual evaluation.
MooseVariableFE< T > & getFieldVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
void prepareVariableNonlocal(MooseVariableFieldBase *var)
virtual SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
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...
virtual std::set< TagID > defaultVectorTags() const
Get the default vector tags associated with this system.
TagName oldSolutionStateVectorName(const unsigned int, Moose::SolutionIterationType iteration_type) const
Gets the vector name used for an old (not current) solution state.
std::array< std::vector< NumericVector< Number > * >, 2 > _solution_states
The solution states (0 = current, 1 = old, 2 = older, etc)
Class for scalar variables (they are different).
IntRange< T > make_range(T beg, T end)
NumericVector< Real > * _saved_dotdot_old
const std::vector< VariableName > & getVariableNames() const
virtual void prepare(THREAD_ID tid)
Prepare the system for use.
virtual void addVariableToZeroOnJacobian(std::string var_name)
Adds this variable to the list of variables to be zeroed during each Jacobian evaluation.
virtual const NumericVector< Number > * solutionPreviousNewton() const
virtual void customSetup(const ExecFlagType &exec_type)
void prepareVariable(MooseVariableFieldBase *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
virtual NumericVector< Number > * solutionUDotOld()=0
virtual NumericVector< Number > * solutionUDotDot()=0
virtual bool isScalarVariable(unsigned int var_name) const
unsigned int nFieldVariables() const
Get the number of field variables in this system.
virtual void set(const numeric_index_type i, const Number value)=0
virtual TagName vectorTagName(const TagID tag) const
Retrieve the name associated with a TagID.
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
virtual bool hasActiveElementalMooseVariables(const THREAD_ID tid) const
Whether or not a list of active elemental moose variables has been set.
virtual void prepareLowerD(THREAD_ID tid)
Prepare the system for use for lower dimensional elements.
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
virtual void deactiveMatrixTag(TagID tag)
deactive a matrix for tag
void setVariableGlobalDoFs(const std::string &var_name)
set all the global dof indices for a variable
std::vector< NumericVector< Number > * > _tagged_vectors
Tagged vectors (pointer)
NumericVector< Number > & solutionOld()
virtual bool hasScalarVariable(const std::string &var_name) const
const TagName PREVIOUS_NL_SOLUTION_TAG
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.
virtual void initialSetup()
Setup Functions.
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int nl_sys_num)=0
virtual void restoreSolutions()
Restore current solutions (call after your solve failed)
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
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.
virtual void residualSetup()
std::vector< NumericVector< Number > * > _saved_solution_states
The saved solution states (0 = current, 1 = old, 2 = older, etc)
virtual void disassociateDefaultMatrixTags()
Disassociate the matrices associated with the default matrix tags of this system. ...
void clearAllDofIndices()
Clear all dof indices from moose variables.
unsigned int _max_var_number
Maximum variable number.
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.
auto index_range(const T &sizable)
void flushTaggedMatrices(const std::set< TagID > &tags)
flushes all matrices associated to tags.
virtual bool matrixTagExists(const TagName &tag_name) const
Check to see if a particular Tag exists.
virtual TagName matrixTagName(TagID tag)
Retrieve the name associated with a TagID.
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
virtual void timestepSetup()
MooseVariableField< T > & getActualFieldVariable(THREAD_ID tid, const std::string &var_name)
Returns a field variable pointer - this includes finite volume variables.