https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MooseVariableDataLinearFV.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "MooseArray.h"
13#include "MooseTypes.h"
16#include "TheWarehouse.h"
17
18#include "libmesh/tensor_tools.h"
19#include "libmesh/vector_value.h"
20#include "libmesh/tensor_value.h"
21#include "libmesh/type_n_tensor.h"
22#include "libmesh/fe_type.h"
23#include "libmesh/dof_map.h"
24#include "libmesh/enum_fe_family.h"
25#include "SubProblem.h"
26#include "MooseVariableDataFV.h"
27
28#include <functional>
29#include <vector>
30
31class FaceInfo;
32class SystemBase;
33class TimeIntegrator;
34class Assembly;
35
36template <typename>
37class MooseVariableFV;
38
39namespace libMesh
40{
41class QBase;
42}
43
50template <typename OutputType>
52{
53public:
54 // type for gradient, second and divergence of template class OutputType
58
59 // shortcut for types storing values on quadrature points
65
66 // shape function type for the template class OutputType
68
69 // type for gradient, second and divergence of shape functions of template class OutputType
73
76
78 SystemBase & sys,
79 THREAD_ID tid,
80 Moose::ElementType element_type,
81 const Elem * const & elem);
82
83 bool isNodal() const override { return false; }
84 bool hasDoFsOnNodes() const override { return false; }
86
91 void setGeometry(Moose::GeometryType gm_type);
92
96 void computeValues();
97
101 void prepareIC();
102
106 void setDofValues(const DenseVector<DofValue> & values);
107
111 void setDofValue(const DofValue & value, unsigned int index);
112
118 void getDofIndices(const Elem * elem, std::vector<dof_id_type> & dof_indices) const;
119
123 const std::vector<dof_id_type> & dofIndices() const;
124
128 unsigned int numberOfDofs() const;
129
134 {
135 _dof_indices.clear();
136 _prev_elem = nullptr;
137 }
138
139protected:
143 virtual const MooseLinearVariableFV<OutputType> & var() const override;
144
145private:
146 void initializeSolnVars();
147
150
153
155 const unsigned int _var_num;
156
159
162
165
169 const Elem * const & _elem;
170
172 mutable const Elem * _prev_elem = nullptr;
173
177 const std::vector<dof_id_type> & initDofIndices();
178
180 const bool _displaced;
181
184
185 using MooseVariableDataBase<OutputType>::_sys;
186 using MooseVariableDataBase<OutputType>::_subproblem;
191 using MooseVariableDataBase<OutputType>::_vector_tag_u;
195 using MooseVariableDataBase<OutputType>::_matrix_tag_u;
197 using MooseVariableDataBase<OutputType>::_dof_indices;
202 using MooseVariableDataBase<OutputType>::_solution_tag;
206 using MooseVariableDataBase<OutputType>::_dof_map;
207 using MooseVariableDataBase<OutputType>::_need_u_dot;
227 using MooseVariableDataBase<OutputType>::_tid;
233
234 friend void Moose::initDofIndices<>(MooseVariableDataLinearFV<OutputType> &, const Elem &);
235};
236
238
239template <typename OutputType>
240const std::vector<dof_id_type> &
242{
243 return const_cast<MooseVariableDataLinearFV<OutputType> *>(this)->initDofIndices();
244}
245
246template <typename OutputType>
247unsigned int
249{
250 return dofIndices().size();
251}
unsigned int THREAD_ID
Definition MooseTypes.h:237
std::array< Real, 2 > values
Definition MortarUtils.C:52
Keeps track of stuff related to assembling.
Definition Assembly.h:110
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
forward declarations
Definition MooseArray.h:18
This class provides variable solution interface for linear finite volume problems.
OutputType _nodal_value_dotdot
nodal values of u_dotdot
std::vector< dof_id_type > _dof_indices
The dof indices for the current element.
OutputType _nodal_value_dot_old
nodal values of u_dot_old
bool _need_dof_values_dot
local solution flags
std::vector< FieldVariableValue > _vector_tag_u
TagID _previous_nl_solution_tag
The vector tag ID corresponding to the previous nonlinear iteration's solution vector.
DofValues _dof_values_dotdot
second time derivative of the solution values
TagID _old_solution_tag
The vector tag ID corresponding to the old solution vector.
SystemBase & _sys
The MOOSE system which ultimately holds the vectors and matrices relevant to this variable data.
std::vector< FieldVariableValue > _matrix_tag_u
std::vector< bool > _need_matrix_tag_u
Moose::DOFType< OutputType >::type DofValue
void fetchDofValues()
Helper methods for assigning dof values from their corresponding solution values.
const libMesh::DofMap & _dof_map
The degree of freedom map from libMesh.
OutputType _nodal_value_dotdot_old
nodal values of u_dotdot_old
std::vector< DofValues > _vector_tags_dof_u
TagID _solution_tag
The vector tag ID corresponding to the solution vector.
std::vector< bool > _need_matrix_tag_dof_u
std::vector< DofValues > _matrix_tags_dof_u
TagID _older_solution_tag
The vector tag ID corresponding to the older solution vector.
std::vector< bool > _need_vector_tag_u
DofValues _dof_values_dot_old
the previous time step's solution value time derivative
DofValues _dof_values_dot
time derivative of the solution values
MooseArray< libMesh::Number > _dof_du_dotdot_du
derivatives of the solution value second time derivative with respect to the degrees of freedom
std::vector< FieldVariableGradient > _vector_tag_grad
DofValues _dof_values_dotdot_old
the previous time step's solution value second time derivative
std::set< TagID > _required_vector_tags
The set of vector tags (residual + solution) we need to evaluate.
const THREAD_ID _tid
The thread ID that this object is on.
std::vector< bool > _need_vector_tag_dof_u
bool _need_grad_dot
gradient dot flags
OutputType _nodal_value_dot
nodal values of u_dot
const SubProblem & _subproblem
The subproblem which we can query for information related to tagged vectors and matrices.
bool _has_dof_values
Whether we currently have degree of freedom values stored in our local containers (corresponding to t...
MooseArray< libMesh::Number > _dof_du_dot_du
derivatives of the solution value time derivative with respect to the degrees of freedom
std::vector< bool > _need_vector_tag_grad
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.
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 .
unsigned int numberOfDofs() const
Get the number of dofs on the current element.
const MooseLinearVariableFV< OutputType > & _var
A const reference to the owning MooseLinearVariableFV object.
MooseArray< OutputGradient > FieldVariableGradient
libMesh::TensorTools::IncrementRank< OutputGradient >::type OutputSecond
libMesh::TensorTools::IncrementRank< OutputShape >::type OutputShapeGradient
MooseArray< OutputType > FieldVariableCurl
const std::vector< dof_id_type > & dofIndices() const
Get the dof indices of the current element.
bool hasDoFsOnNodes() const override
Whether this data is associated with a variable that has DoFs on nodes.
libMesh::TensorTools::DecrementRank< OutputShape >::type OutputShapeDivergence
const Elem *const & _elem
The current elem.
MooseArray< OutputSecond > FieldVariableSecond
const bool _displaced
Whether this variable is being calculated on a displaced system.
const libMesh::QBase * _qrule
Pointer to the quadrature rule.
libMesh::TensorTools::IncrementRank< OutputType >::type OutputGradient
libMesh::TensorTools::IncrementRank< OutputShapeGradient >::type OutputShapeSecond
Moose::ElementType _element_type
The element type this object is storing data for. This is either Element, Neighbor,...
MooseArray< OutputDivergence > FieldVariableDivergence
const TimeIntegrator *const _time_integrator
Pointer to time integrator.
Moose::ShapeType< OutputType >::type OutputShape
const Assembly & _assembly
Reference to the system assembly of the variable.
libMesh::FEContinuity getContinuity() const override
Return the variable continuity.
libMesh::TensorTools::DecrementRank< OutputType >::type OutputDivergence
const Elem * _prev_elem
used to keep track of when dof indices are out of date
const libMesh::FEType & _fe_type
Reference to the variable's finite element type.
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 .
MooseArray< OutputType > FieldVariableValue
const unsigned int _var_num
The index of the variable in the system.
void clearDofIndices()
Clear the dof indices in the cache.
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.
This class provides variable solution values for other classes/objects to bind to when looping over f...
Base class for a system (of equations)
Definition SystemBase.h:87
Base class for time integrators.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
OutputType type
Definition MooseTypes.h:291