31 #include "libmesh/dof_map.h" 32 #include "libmesh/string_to_enum.h" 33 #include "libmesh/fe_interface.h" 48 std::vector<dof_id_type> & n_nz,
49 std::vector<dof_id_type> & n_oz,
58 const std::string & name,
62 _subproblem(subproblem),
63 _fe_problem(fe_problem),
64 _app(subproblem.getMooseApp()),
65 _factory(_app.getFactory()),
66 _mesh(subproblem.
mesh()),
74 _u_dotdot_old(nullptr),
76 _saved_older(nullptr),
77 _saved_dot_old(nullptr),
78 _saved_dotdot_old(nullptr),
80 _max_var_n_dofs_per_elem(0),
81 _max_var_n_dofs_per_node(0),
82 _automatic_scaling(false),
84 _solution_states_initialized(false)
94 mooseError(
"Variable '", var_name,
"' does not exist in this system");
108 template <
typename T>
112 return *
_vars[tid].getFieldVariable<T>(var_name);
115 template <
typename T>
119 return *
_vars[tid].getActualFieldVariable<T>(var_name);
122 template <
typename T>
126 return *
_vars[tid].getFVVariable<T>(var_name);
129 template <
typename T>
133 return *
_vars[tid].getFieldVariable<T>(var_number);
136 template <
typename T>
140 return *
_vars[tid].getActualFieldVariable<T>(var_number);
148 mooseError(
"Scalar variable '" + var_name +
"' does not exist in this system");
162 const std::set<SubdomainID> *
165 mooseAssert(
_var_map.find(var_number) !=
_var_map.end(),
"Variable does not exist.");
189 Threads::parallel_reduce(elem_range, aldit);
192 aldit.dofIndicesSetUnion();
194 const auto & all_dof_indices = aldit.getDofIndices();
201 if (vars_to_be_zeroed.size() > 0)
207 mooseError(
"System needs to be registered in FEProblemBase for using zeroVariables.");
211 Threads::parallel_reduce(elem_range, aldit);
217 for (
const auto & dof : dof_indices_to_zero)
243 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[0].fieldVariables();
244 for (
const auto & var :
vars)
246 FEType fe_type = var->feType();
259 const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
261 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
262 for (
const auto & var :
vars)
263 var->clearDofIndices();
265 for (
const auto & var : active_elemental_moose_variables)
266 if (&(var->sys()) ==
this)
271 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
272 for (
const auto & var :
vars)
283 const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
286 std::vector<MooseVariableFieldBase *> newly_prepared_vars;
288 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
289 for (
const auto & var :
vars)
291 mooseAssert(&var->sys() ==
this,
292 "I will cry if we store variables in our warehouse that don't belong to us");
304 if (!active_elemental_moose_variables.count(var))
307 newly_prepared_vars.push_back(var);
313 for (
const auto var_ptr : newly_prepared_vars)
325 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
326 for (
const auto & var :
vars)
327 var->prepareNeighbor();
333 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
334 for (
const auto & var :
vars)
335 var->prepareLowerD();
343 const std::set<MooseVariableFieldBase *> & active_elemental_moose_variables =
345 for (
const auto & var : active_elemental_moose_variables)
346 if (&(var->sys()) ==
this)
347 var->computeElemValues();
351 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
352 for (
const auto & var :
vars)
353 var->computeElemValues();
360 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
361 for (
const auto & var :
vars)
362 var->computeElemValuesFace();
368 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
369 for (
const auto & var :
vars)
370 var->computeNeighborValuesFace();
376 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
377 for (
const auto & var :
vars)
378 var->computeNeighborValues();
384 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
385 for (
const auto & var :
vars)
386 var->computeLowerDValues();
392 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
393 for (
const auto & var :
vars)
396 if (var->isNodalDefined())
397 var->computeNodalValues();
404 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
405 for (
const auto & var :
vars)
408 if (var->isNodalDefined())
409 var->computeNodalValues();
416 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
417 for (
const auto & var :
vars)
419 var->reinitNodes(nodes);
420 var->computeNodalValues();
427 const std::vector<MooseVariableFieldBase *> &
vars =
_vars[tid].fieldVariables();
428 for (
const auto & var :
vars)
430 var->reinitNodesNeighbor(nodes);
431 var->computeNodalNeighborValues();
438 const std::vector<MooseVariableScalar *> &
vars =
_vars[tid].scalars();
439 for (
const auto & var :
vars)
440 var->reinit(reinit_for_derivative_reordering);
450 std::vector<dof_id_type> dof_indices;
454 unsigned int sys_num = sys.
number();
458 for (
const auto & elem_id : ghosted_elems)
467 for (
const auto & dof : dof_indices)
469 send_list.push_back(dof);
474 for (
unsigned int n = 0; n < elem->
n_nodes(); n++)
479 for (
unsigned int v = 0; v <
n_vars; v++)
482 unsigned int var_num = var.
number();
486 if (node->
n_dofs(sys_num, var_num) > 0)
489 for (
unsigned int c = 0; c < n_comp; c++)
490 send_list.push_back(node->
dof_number(sys_num, var_num, c));
509 for (
unsigned int i = 1; i <= states - 1; ++i)
514 for (
unsigned int i = 1; i <= states - 1; ++i)
539 for (
unsigned int i = 1; i <= states - 1; ++i)
543 removeVector(
"save_solution_state_" + std::to_string(i));
565 mooseError(
"Cannot add tagged matrix with TagID ",
569 "' because the tag does not exist in the problem");
585 mooseError(
"Cannot remove the matrix with TagID ",
589 "', because that tag does not exist in the problem");
613 mooseError(
"Cannot add tagged vector with TagID ",
617 "' because the tag does not exist in the problem");
623 if (type != ParallelType::AUTOMATIC && vec.
type() != type)
628 "' because a vector with the same name was found with a different parallel type");
648 "' because that tag does not exist in the problem");
650 mooseError(
"Cannot close vector tag with name '",
654 "' because there is no vector associated with that tag");
661 for (
const auto tag : tags)
673 "' because that tag does not exist in the problem");
675 mooseError(
"Cannot zero vector tag with name '",
679 "' because there is no vector associated with that tag");
687 for (
const auto tag : tags)
695 mooseError(
"Cannot remove the vector with TagID ",
699 "', because that tag does not exist in the problem");
711 const std::string & name,
716 auto components = parameters.
get<
unsigned int>(
"components");
720 std::set<SubdomainID>
blocks;
721 const auto & block_param = parameters.
get<std::vector<SubdomainName>>(
"block");
722 for (
const auto & subdomain_name : block_param)
730 Utility::string_to_enum<FEFamily>(parameters.
get<
MooseEnum>(
"family")));
731 const auto fe_field_type = FEInterface::field_type(fe_type);
733 unsigned int var_num;
735 if (var_type ==
"ArrayMooseVariable")
738 mooseError(
"Vector family type cannot be used in an array variable");
740 std::vector<std::string> array_var_component_names;
741 const bool has_array_names = parameters.
isParamValid(
"array_var_component_names");
744 array_var_component_names =
745 parameters.
get<std::vector<std::string>>(
"array_var_component_names");
746 if (array_var_component_names.size() != components)
749 ", parameter 'array_var_component_names' has ",
750 array_var_component_names.size(),
751 " name(s), but there are ",
753 " array variable component(s).");
757 std::vector<std::string> var_names;
758 for (
unsigned int i = 0; i < components; i++)
760 if (!has_array_names)
761 array_var_component_names.push_back(std::to_string(i));
762 var_names.push_back(
name +
"_" + array_var_component_names[i]);
766 parameters.
set<std::vector<std::string>>(
"array_var_component_names") =
767 array_var_component_names;
777 "' is an array variable ('components' > 1) but 'array' is set to false.");
778 parameters.
set<
bool>(
"array") =
true;
785 "' is a regular variable. 'array_var_component_names' should not be set.");
789 parameters.
set<
unsigned int>(
"_var_num") = var_num;
795 std::shared_ptr<MooseVariableBase> var =
800 if (
auto fe_var = dynamic_cast<MooseVariableFieldBase *>(var.get()))
802 auto required_size = var_num + components;
805 for (MooseIndex(components) component = 0; component < components; ++component)
818 if (var->blockRestricted())
820 for (MooseIndex(components) component = 0; component < components; ++component)
821 _var_map[var_num + component].insert(
id);
823 for (MooseIndex(components) component = 0; component < components; ++component)
824 _var_map[var_num + component] = std::set<SubdomainID>();
837 if (
system().has_variable(var_name))
839 if (std::find(names.begin(), names.end(), var_name) != names.end())
850 if (!
system().has_variable(var_name) &&
851 std::find(names.begin(), names.end(), var_name) != names.end())
861 if (
system().has_variable(var_name))
870 return (
system().variable(var_num).type().family ==
SCALAR);
877 n +=
_vars[0].scalars().size();
886 for (
auto & var :
_vars[0].fieldVariables())
896 for (
auto & var :
_vars[0].fieldVariables())
933 mooseError(
"Cannot retreive vector with tag ", tag,
" because that tag does not exist");
935 mooseError(
"Cannot retreive vector with tag ",
939 "'\nbecause a vector has not been associated with that tag.");
951 mooseError(
"Cannot retreive vector with tag ", tag,
" because that tag does not exist");
953 mooseError(
"Cannot retreive vector with tag ",
957 "'\nbecause a vector has not been associated with that tag.");
967 mooseError(
"Cannot associate vector to tag ", tag,
" because that tag does not exist");
979 mooseError(
"Cannot disassociate vector from tag ", tag,
" because that tag does not exist");
981 mooseError(
"You can not disassociate a vector from a tag which it was not associated to");
990 mooseError(
"Cannot disassociate vector from tag ", tag,
" because that tag does not exist");
1001 for (
const auto tag : tags)
1012 mooseError(
"Cannot retreive matrix with tag ", tag,
" because that tag does not exist");
1014 mooseError(
"Cannot retreive matrix with tag ",
1018 "'\nbecause a matrix has not been associated with that tag.");
1030 mooseError(
"Cannot retreive matrix with tag ", tag,
" because that tag does not exist");
1032 mooseError(
"Cannot retreive matrix with tag ",
1036 "'\nbecause a matrix has not been associated with that tag.");
1045 for (
auto tag : tags)
1053 for (
auto tag : tags)
1062 mooseError(
"Cannot associate matrix to tag ", tag,
" because that tag does not exist");
1074 mooseError(
"Cannot disassociate matrix from tag ", tag,
" because that tag does not exist");
1076 mooseError(
"You can not disassociate a matrix from a tag which it was not associated to");
1085 mooseError(
"Cannot disassociate matrix from tag ", tag,
" because that tag does not exist");
1096 for (
const auto tag : tags)
1105 "Cannot active Matrix with matrix_tag : " << tag <<
"that does not exist");
1117 "Cannot deactivate Matrix with matrix_tag : " << tag <<
"that does not exist");
1132 for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1143 for (decltype(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
1178 const std::string & source_name,
1179 const std::string & timestep)
1189 bool did_copy =
false;
1194 if (vci._timestep ==
"LATEST")
1200 if (timestep > n_steps)
1201 mooseError(
"Invalid value passed as \"initial_from_file_timestep\". Expected \"LATEST\" or " 1202 "a valid integer between 1 and ",
1204 " inclusive, received ",
1212 const auto & var =
getVariable(0, vci._dest_name);
1215 const auto & array_var = getFieldVariable<RealEigenVector>(0, vci._dest_name);
1216 for (MooseIndex(var.count()) i = 0; i < var.count(); ++i)
1218 const auto & exodus_var = var.arrayVariableComponent(i);
1219 const auto & system_var = array_var.componentName(i);
1237 mooseError(
"Unrecognized variable ", vci._dest_name,
" in variables to copy.");
1276 for (
unsigned int i = states - 1; i > 0; --i)
1294 for (
unsigned int i = states - 1; i > 0; --i)
1310 mooseError(
"Cannot restore solutions without old solution");
1357 unsigned int state = 0;
1361 state =
std::max(state, var->oldestSolutionStateRequested());
1363 state =
std::max(state, var->oldestSolutionStateRequested());
1374 mooseAssert(state != 0,
"Not an old state");
1380 else if (state == 2)
1386 return "solution_state_" + std::to_string(state) +
"_" +
Moose::stringify(iteration_type);
1396 "': solution state ",
1398 " was requested in ",
1400 " but only up to state ",
1401 (
_solution_states[static_cast<unsigned short>(iteration_type)].size() == 0)
1403 :
_solution_states[static_cast<unsigned short>(iteration_type)].size() - 1,
1406 const auto & solution_states =
_solution_states[
static_cast<unsigned short>(iteration_type)];
1409 mooseAssert(solution_states[0] == &
solutionInternal(),
"Inconsistent current solution");
1411 mooseAssert(solution_states[state] ==
1413 "Inconsistent solution state");
1415 return *solution_states[state];
1424 return *
_solution_states[
static_cast<unsigned short>(iteration_type)][state];
1431 libmesh_parallel_only(this->
comm());
1432 mooseAssert(!Threads::in_threads,
1433 "This routine is not thread-safe. Request the solution state before using it in " 1434 "a threaded region.");
1439 auto & solution_states =
_solution_states[
static_cast<unsigned short>(iteration_type)];
1440 solution_states.resize(state + 1);
1443 if (!solution_states[0])
1446 mooseAssert(solution_states[0] == &
solutionInternal(),
"Inconsistent current solution");
1449 for (
unsigned int i = 1; i <= state; ++i)
1450 if (!solution_states[i])
1458 "Inconsistent solution state");
1464 for (MooseIndex(
_vars) thread = 0; thread <
_vars.size(); ++thread)
1466 auto & field_variables =
_vars[thread].fieldVariables();
1467 for (MooseIndex(field_variables) i = 0, p = 0; i < field_variables.size(); ++i)
1469 auto factors = field_variables[i]->arrayScalingFactor();
1470 for (
unsigned int j = 0; j < field_variables[i]->count(); ++j, ++p)
1471 factors[j] /= inverse_scaling_factors[p];
1473 field_variables[i]->scalingFactor(factors);
1476 auto offset = field_variables.size();
1478 auto & scalar_variables =
_vars[thread].scalars();
1479 for (MooseIndex(scalar_variables) i = 0; i < scalar_variables.size(); ++i)
1480 scalar_variables[i]->scalingFactor(
1481 {1. / inverse_scaling_factors[offset + i] * scalar_variables[i]->scalingFactor()});
1485 _console <<
"Automatic scaling factors:\n";
1491 for (
const auto & field_variable : field_variables)
1493 const auto & factors = field_variable->arrayScalingFactor();
1494 _console <<
" " << field_variable->name() <<
":";
1495 for (
const auto i :
make_range(field_variable->count()))
1499 for (
const auto & scalar_variable : scalar_variables)
1500 _console <<
" " << scalar_variable->name() <<
": " << scalar_variable->scalingFactor()
1514 addVector(
"scaling_factors",
false, libMesh::ParallelType::GHOSTED);
1531 bool gradient_storage_initialized =
false;
1532 for (
const auto & field_var :
_vars[0].fieldVariables())
1533 if (!gradient_storage_initialized && field_var->needsGradientVectorStorage())
1582 for (
auto & var_warehouse :
_vars)
1583 var_warehouse.clearAllDofIndices();
1589 _vars[tid].setActiveVariableCoupleableVectorTags(vtags);
1596 _vars[tid].setActiveScalarVariableCoupleableVectorTags(vtags);
1626 const std::string & name,
1643 if (ti->integratesVar(var_num))
1657 mooseError(
"No time integrator found that integrates variable number ",
1658 std::to_string(var_num));
1661 const std::vector<std::shared_ptr<TimeIntegrator>> &
1673 const std::set<SubdomainID> &
1686 const std::string & var_name);
1689 SystemBase::getFieldVariable<RealVectorValue>(
THREAD_ID tid,
const std::string & var_name);
1692 SystemBase::getFieldVariable<RealEigenVector>(
THREAD_ID tid,
const std::string & var_name);
1695 unsigned int var_number);
1698 SystemBase::getFieldVariable<RealVectorValue>(
THREAD_ID tid,
unsigned int var_number);
1701 SystemBase::getFieldVariable<RealEigenVector>(
THREAD_ID tid,
unsigned int var_number);
1704 SystemBase::getActualFieldVariable<Real>(
THREAD_ID tid,
const std::string & var_name);
1707 SystemBase::getActualFieldVariable<RealVectorValue>(
THREAD_ID tid,
const std::string & var_name);
1710 SystemBase::getActualFieldVariable<RealEigenVector>(
THREAD_ID tid,
const std::string & var_name);
1713 SystemBase::getActualFieldVariable<Real>(
THREAD_ID tid,
unsigned int var_number);
1716 SystemBase::getActualFieldVariable<RealVectorValue>(
THREAD_ID tid,
unsigned int var_number);
1719 SystemBase::getActualFieldVariable<RealEigenVector>(
THREAD_ID tid,
unsigned int var_number);
1722 const std::string & var_name);
std::string name(const ElemQuality q)
void zeroTaggedVector(const TagID tag)
Zero vector with the given tag.
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
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.
dof_id_type end_dof(const processor_id_type proc) const
libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
std::vector< dof_id_type > _var_all_dof_indices
Container for the dof indices of a given variable.
std::vector< Real > _du_dot_du
Derivative of time derivative of u with respect to uj.
const Variable & variable(unsigned int var) const
virtual NumericVector< Number > & solutionInternal() const =0
Internal getter for solution owned by libMesh.
std::vector< libMesh::SparseMatrix< Number > * > _tagged_matrices
Tagged matrices (pointer)
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 bool uDotDotOldRequested()
Get boolean flag to check whether old solution second time derivative needs to be stored...
virtual void augmentSparsity(libMesh::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 void copyOldSolutions()
Shifts the solutions backwards in time.
bool _solution_states_initialized
Whether or not the solution states have been initialized.
virtual bool checkNonlocalCouplingRequirement() const =0
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 bool computingScalingJacobian() const =0
Getter for whether we're computing the scaling jacobian.
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
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::ios_base::fmtflags flags() const
Return the current flags.
NumericVector< Number > * _u_dot_old
old solution vector for u^dot
virtual bool uDotRequested()
Get boolean flag to check whether solution time derivative needs to be stored.
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 bool uDotDotRequested()
Get boolean flag to check whether solution second time derivative needs to be stored.
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
const TimeIntegrator & getTimeIntegrator(const unsigned int var_num) const
Retrieve the time integrator that integrates the given variable's equation.
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.
virtual libMesh::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 libMesh::System & system()=0
Get the reference to the libMesh system.
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 vectorTagNotZeroed(const TagID tag) const
Checks if a vector tag is in the list of vectors that will not be zeroed when other tagged vectors ar...
bool computingScalingJacobian() const
Whether we are computing an initial Jacobian for automatic variable scaling.
NumericVector< Number > * _u_dotdot
solution vector for u^dotdot
const Parallel::Communicator & comm() const
Order default_quadrature_order() const
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
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.
virtual NumericVector< Number > * solutionUDotDotOld()
void removeMatrix(TagID tag)
Removes a matrix with a given tag.
virtual void associateMatrixToTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Associate a matrix to a tag.
This class provides an interface for common operations on field variables of both FE and FV types wit...
const Parallel::Communicator & _communicator
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 addTimeIntegrator(const std::string &type, const std::string &name, InputParameters ¶meters)
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)
std::vector< std::unique_ptr< NumericVector< Number > > > _raw_grad_container
A cache for storing gradients at dof locations.
virtual void copyPreviousNonlinearSolutions()
Shifts the solutions backwards in nonlinear iteration history.
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.
std::unique_ptr< NumericVector< Number > > _serialized_solution
Serialized version of the solution vector, or nullptr if a serialized solution is not needed...
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.
virtual void disassociateMatrixFromTag(libMesh::SparseMatrix< Number > &matrix, TagID tag)
Disassociate a matrix from a tag.
const std::set< dof_id_type > & getDofIndices() const
auto max(const L &left, const R &right)
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
void update()
Update the system (doing libMesh magic)
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()
unsigned int n_dofs(const unsigned int s, const unsigned int var=libMesh::invalid_uint) const
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 libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
void libmesh_ignore(const Args &...)
void copyTimeIntegrators(const SystemBase &other_sys)
Copy time integrators from another system.
unsigned int number() const
virtual NumericVector< Number > & serializedSolution()
Returns a reference to a serialized version of the solution vector for this subproblem.
void remove_vector(std::string_view vec_name)
virtual std::unique_ptr< Base > create()=0
void copyVars(libMesh::ExodusII_IO &io)
int convert< int >(const std::string &str, bool throw_on_failure)
virtual const Number & duDotDu(unsigned int var_num=0) const
virtual unsigned int n_nodes() const=0
const TagName OLD_SOLUTION_TAG
void remove_matrix(std::string_view mat_name)
unsigned int n_components() const
virtual void zeroVariablesForResidual()
Zero out the solution for the variables that were registered as needing to have their solutions zeroe...
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
std::string prefix() const
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
void copy_nodal_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
Information about variables that will be copied.
virtual NumericVector< Number > * solutionUDot()
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 NumericVector< Number > * solutionUDotOld()
virtual void reinitScalars(THREAD_ID tid, bool reinit_for_derivative_reordering=false)
Reinit scalar varaibles.
void copy_elemental_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
SubProblem & _subproblem
The subproblem for whom this class holds variable data, etc; this can either be the governing finite ...
virtual bool uDotOldRequested()
Get boolean flag to check whether old solution time derivative needs to be stored.
bool have_vector(std::string_view vec_name) const
virtual bool matrixTagActive(TagID tag) const
If or not a matrix tag is active.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
virtual void reinitNeighborFace(const Elem *elem, unsigned int side, THREAD_ID tid)
Compute the values of the variables at all the current points.
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
virtual void disassociateVectorFromTag(NumericVector< Number > &vec, TagID tag)
Disassociate a given vector from a given tag.
libMesh::SparseMatrix< Number > & addMatrix(TagID tag)
Adds a matrix with a given tag.
virtual void addDotVectors()
Add u_dot, u_dotdot, u_dot_old and u_dotdot_old vectors if requested by the time integrator.
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 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 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.
const std::vector< std::shared_ptr< TimeIntegrator > > & getTimeIntegrators()
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.
void copy_scalar_solution(System &system, std::vector< std::string > system_var_names, std::vector< std::string > exodus_var_names, unsigned int timestep=1)
virtual void solve()
Solve the system (using libMesh magic)
virtual unsigned int numMatrixTags() const
The total number of tags.
FEProblemBase & _fe_problem
the governing finite element/volume problem
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.
ParallelType type() const
virtual void saveOldSolutions()
Save the old and older solutions.
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
const FEType & variable_type(const unsigned int i) const
Base class for time integrators.
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.
NumericVector< Number > * _u_dot
solution vector for u^dot
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.
const Node * node_ptr(const unsigned int i) const
void prepareVariableNonlocal(MooseVariableFieldBase *var)
virtual libMesh::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 Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num)=0
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)
std::string prefix() const
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)
const TimeIntegrator * queryTimeIntegrator(const unsigned int var_num) const
Retrieve the time integrator that integrates the given variable's equation.
const std::set< SubdomainID > & getSubdomainsForVar(unsigned int var_number) const
void prepareVariable(MooseVariableFieldBase *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
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 T value)=0
virtual void reinitElemFace(const Elem *elem, unsigned int side, THREAD_ID tid)
Reinit assembly info for a side of an element.
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.
const std::string & name() const
dof_id_type first_dof(const processor_id_type proc) const
unsigned int number() const
virtual void deactiveMatrixTag(TagID tag)
deactive a matrix for tag
virtual NumericVector< Number > * solutionUDotDot()
unsigned int n_vars() const
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)
void prefix_with_name(bool value)
NumericVector< Number > & solutionOld()
SystemBase(SubProblem &subproblem, FEProblemBase &fe_problem, const std::string &name, Moose::VarKindType var_kind)
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 void restoreSolutions()
Restore current solutions (call after your solve failed)
SparseMatrix< Number > & add_matrix(std::string_view mat_name, ParallelType type=PARALLEL, MatrixBuildType mat_build_type=MatrixBuildType::AUTOMATIC)
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.
const DofMap & get_dof_map() const
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.
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.
const NumericVector< Number > & get_vector(std::string_view vec_name) const
NumericVector< Number > * _u_dotdot_old
old solution vector for u^dotdot
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.