27#include "libmesh/quadrature.h"
28#include "libmesh/fe_base.h"
29#include "libmesh/system.h"
30#include "libmesh/type_n_tensor.h"
32template <
typename OutputType>
38 const Elem *
const & elem)
41 _fe_type(_var.feType()),
42 _var_num(_var.number()),
43 _assembly(_subproblem.assembly(_tid, var.kind() ==
Moose::VAR_SOLVER ? sys.number() : 0)),
44 _element_type(element_type),
45 _time_integrator(_sys.queryTimeIntegrator(_var_num)),
47 _displaced(dynamic_cast<const
DisplacedSystem *>(&_sys) ? true : false),
52template <
typename OutputType>
60 _qrule = _assembly.qRule();
66 _qrule = _assembly.qRuleFace();
73template <
typename OutputType>
77 auto && active_coupleable_matrix_tags =
78 _sys.subproblem().getActiveFEVariableCoupleableMatrixTags(_tid);
79 mooseAssert(_qrule,
"We should have a non-null qrule");
80 const auto nqp = _qrule->n_points();
82 for (
auto tag : _required_vector_tags)
83 if (_need_vector_tag_u[tag])
85 _vector_tag_u[tag].resize(nqp);
86 assignForAllQps(0, _vector_tag_u[tag], nqp);
89 for (
auto tag : active_coupleable_matrix_tags)
90 if (_need_matrix_tag_u[tag])
92 _matrix_tag_u[tag].resize(nqp);
93 assignForAllQps(0, _matrix_tag_u[tag], nqp);
97template <
typename OutputType>
98const std::vector<dof_id_type> &
106template <
typename OutputType>
110 getDofIndices(_elem, _dof_indices);
111 initializeSolnVars();
113 unsigned int num_dofs = _dof_indices.size();
121 mooseAssert(num_dofs == 1 && _vector_tags_dof_u[_solution_tag].size() == 1,
122 "There should only be one dof per elem for FV variables");
124 const auto nqp = _qrule->n_points();
125 auto && active_coupleable_matrix_tags =
126 _sys.subproblem().getActiveFEVariableCoupleableMatrixTags(_tid);
128 for (
const auto qp : make_range(nqp))
130 for (
auto tag : _required_vector_tags)
131 if (_need_vector_tag_u[tag])
132 _vector_tag_u[tag][qp] = _vector_tags_dof_u[tag][0];
134 for (
auto tag : active_coupleable_matrix_tags)
135 if (_need_matrix_tag_u[tag])
136 _matrix_tag_u[tag][qp] = _matrix_tags_dof_u[tag][0];
140template <
typename OutputType>
145 _vector_tags_dof_u[_solution_tag].resize(_dof_indices.size());
148template <
typename OutputType>
152 mooseAssert(index == 0,
"We only ever have one dof value locally");
153 _vector_tags_dof_u[_solution_tag][index] = value;
154 _has_dof_values =
true;
156 auto & u = _vector_tag_u[_solution_tag];
158 for (
const auto qp : index_range(u))
162template <
typename OutputType>
166 auto & dof_values = _vector_tags_dof_u[_solution_tag];
167 for (
unsigned int i = 0; i <
values.size(); i++)
168 dof_values[i] =
values(i);
169 _has_dof_values =
true;
172template <
typename OutputType>
175 std::vector<dof_id_type> & dof_indices)
const
178 const auto n_dofs = elem->n_dofs(_sys.number(), _var_num);
181 mooseAssert(n_dofs == 1,
"Should be just one dof");
182 dof_indices.resize(1);
183 dof_indices[0] = elem->dof_number(_sys.number(), _var_num, 0);
189template <
typename OutputType>
std::array< Real, 2 > values
This class provides variable solution interface for linear finite volume problems.
Moose::DOFType< OutputType >::type DofValue
Class holding the data members for linear finite volume variables.
void setGeometry(Moose::GeometryType gm_type)
Set the geometry type before calculating variables values.
void prepareIC()
Prepare the initial condition: initialize DOF indices and resize the DOF value array.
void initializeSolnVars()
virtual const MooseLinearVariableFV< OutputType > & var() const override
Get the corresponding variable.
void setDofValues(const DenseVector< DofValue > &values)
Set local DOF values to the entries of values .
MooseVariableDataLinearFV(const MooseLinearVariableFV< OutputType > &var, SystemBase &sys, THREAD_ID tid, Moose::ElementType element_type, const Elem *const &elem)
void getDofIndices(const Elem *elem, std::vector< dof_id_type > &dof_indices) const
Get the dof indices for an element.
void setDofValue(const DofValue &value, unsigned int index)
Set local DOF value at index to value .
void computeValues()
Compute the variable values.
const std::vector< dof_id_type > & initDofIndices()
Fetch and return the dof indices of this variable on the current element.
Base class for a system (of equations)
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
void initDofIndices(T &data, const Elem &elem)