Go to the documentation of this file.
17 #include "libmesh/variable.h"
18 #include "libmesh/dof_map.h"
19 #include "libmesh/system.h"
20 #include "libmesh/fe_type.h"
21 #include "libmesh/string_to_enum.h"
36 "CONSTANT FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGHTH NINTH TENTH ELEVENTH TWELFTH "
37 "THIRTEENTH FOURTEENTH FIFTEENTH SIXTEENTH SEVENTEENTH EIGHTTEENTH NINETEENTH TWENTIETH "
38 "TWENTYFIRST TWENTYSECOND TWENTYTHIRD TWENTYFOURTH TWENTYFIFTH TWENTYSIXTH TWENTYSEVENTH "
39 "TWENTYEIGHTH TWENTYNINTH THIRTIETH THIRTYFIRST THIRTYSECOND THIRTYTHIRD THIRTYFOURTH "
40 "THIRTYFIFTH THIRTYSIXTH THIRTYSEVENTH THIRTYEIGHTH THIRTYNINTH FORTIETH FORTYFIRST "
41 "FORTYSECOND FORTYTHIRD",
46 "Order of the FE shape function to use for this variable (additional "
47 "orders not listed here are allowed, depending on the family).");
49 MooseEnum family(
"LAGRANGE MONOMIAL HERMITE SCALAR HIERARCHIC CLOUGH XYZ SZABAB BERNSTEIN "
50 "L2_LAGRANGE L2_HIERARCHIC NEDELEC_ONE LAGRANGE_VEC MONOMIAL_VEC",
53 "family", family,
"Specifies the family of FE shape functions to use for this variable.");
55 params.
addParam<std::vector<Real>>(
"initial_condition",
56 "Specifies the initial condition for this variable");
59 "components", 1,
"components>0",
"Number of components for an array variable");
62 params.
addParam<std::vector<Real>>(
"scaling",
63 "Specifies a scaling factor to apply to this variable");
64 params.
addParam<
bool>(
"eigen",
false,
"True to make this variable an eigen variable");
75 "Base class for Moose variables. This should never be the terminal object type");
84 _fe_type(Utility::string_to_enum<Order>(getParam<
MooseEnum>(
"order")),
85 Utility::string_to_enum<FEFamily>(getParam<
MooseEnum>(
"family"))),
86 _var_num(getParam<unsigned int>(
"_var_num")),
88 _subproblem(_sys.subproblem()),
89 _variable(_sys.
system().variable(_var_num)),
90 _assembly(_subproblem.assembly(getParam<
THREAD_ID>(
"_tid"))),
91 _dof_map(_sys.dofMap()),
92 _mesh(_subproblem.mesh()),
94 _count(getParam<unsigned int>(
"components")),
95 _scaling_factor(isParamValid(
"scaling") ? getParam<
std::vector<Real>>(
"scaling")
96 :
std::vector<Real>(_count, 1.))
101 std::size_t found = name0.find_last_of(
"_");
102 if (found == std::string::npos)
103 mooseError(
"Error creating ArrayMooseVariable name with base name ", name0);
110 const std::vector<dof_id_type> &
117 mooseError(
"VariableAllDoFMap not prepared for ",
119 " . Check nonlocal coupling requirement for the variable.");
128 std::vector<dof_id_type>
130 unsigned int component)
const
132 std::vector<dof_id_type> new_dof_indices(dof_indices);
136 for (
auto &
id : new_dof_indices)
140 unsigned int n = dof_indices.size();
141 for (
auto &
id : new_dof_indices)
145 return new_dof_indices;
std::map< std::string, std::vector< dof_id_type > > _var_dof_map
static InputParameters validParams()
void mooseError(Args &&... args) const
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
MooseVariableBase(const InputParameters ¶meters)
FEType _fe_type
The FEType associated with this variable.
static InputParameters validParams()
virtual System & system()=0
Get the reference to the libMesh system.
A class to provide an common interface to objects requiring "outputs" option.
Every object that can be built by the factory should be derived from this class.
const unsigned int _count
Number of variables in the array.
virtual SubProblem & subproblem()
const std::vector< dof_id_type > & allDofIndices() const
Get all global dofindices for the variable.
unsigned int _var_num
variable number (from libMesh)
Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int.
std::string _var_name
Variable name.
SystemBase & _sys
System this variable is part of.
registerMooseObject("MooseApp", MooseVariableBase)
defineLegacyParams(MooseVariableBase)
VarKindType
Framework-wide stuff.
static InputParameters validParams()
An interface that restricts an object to subdomains via the 'blocks' input parameter.
Base class for a system (of equations)
std::vector< dof_id_type > componentDofIndices(const std::vector< dof_id_type > &dof_indices, unsigned int component) const
Obtain DoF indices of a component with the indices of the 0th component.
virtual bool isNodal() const
Is this variable nodal.
static InputParameters validParams()
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const std::string & name() const override
Get the variable name.