https://mooseframework.inl.gov
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"
14 #include "MeshChangedInterface.h"
15 #include "MooseVariableDataBase.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 
31 class FaceInfo;
32 class SystemBase;
33 class TimeIntegrator;
34 class Assembly;
35 
36 template <typename>
37 class MooseVariableFV;
38 
39 namespace libMesh
40 {
41 class QBase;
42 }
43 
50 template <typename OutputType>
52 {
53 public:
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 
74  // DoF value type for the template class OutputType
77 
79  SystemBase & sys,
80  THREAD_ID tid,
81  Moose::ElementType element_type,
82  const Elem * const & elem);
83 
84  bool isNodal() const override { return false; }
85  bool hasDoFsOnNodes() const override { return false; }
87 
92  void setGeometry(Moose::GeometryType gm_type);
93 
97  void computeValues();
98 
102  void setDofValues(const DenseVector<OutputData> & values);
103 
107  void setDofValue(const OutputData & value, unsigned int index);
108 
114  void getDofIndices(const Elem * elem, std::vector<dof_id_type> & dof_indices) const;
115 
119  const std::vector<dof_id_type> & dofIndices() const;
120 
124  unsigned int numberOfDofs() const;
125 
130  {
131  _dof_indices.clear();
132  _prev_elem = nullptr;
133  }
134 
135 protected:
139  virtual const MooseLinearVariableFV<OutputType> & var() const override;
140 
141 private:
142  void initializeSolnVars();
143 
146 
149 
151  const unsigned int _var_num;
152 
155 
158 
161 
165  const Elem * const & _elem;
166 
168  mutable const Elem * _prev_elem = nullptr;
169 
173  const std::vector<dof_id_type> & initDofIndices();
174 
176  const bool _displaced;
177 
180 
229 
230  friend void Moose::initDofIndices<>(MooseVariableDataLinearFV<OutputType> &, const Elem &);
231 };
232 
234 
235 template <typename OutputType>
236 const std::vector<dof_id_type> &
238 {
239  return const_cast<MooseVariableDataLinearFV<OutputType> *>(this)->initDofIndices();
240 }
241 
242 template <typename OutputType>
243 unsigned int
245 {
246  return dofIndices().size();
247 }
void initDofIndices(T &data, const Elem &elem)
unsigned int numberOfDofs() const
Get the number of dofs on the current element.
void clearDofIndices()
Clear the dof indices in the cache.
MooseVariableDataLinearFV(const MooseLinearVariableFV< OutputType > &var, SystemBase &sys, THREAD_ID tid, Moose::ElementType element_type, const Elem *const &elem)
Keeps track of stuff related to assembling.
Definition: Assembly.h:101
Moose::ElementType _element_type
The element type this object is storing data for. This is either Element, Neighbor, or Lower.
OutputType type
Definition: MooseTypes.h:268
const bool _displaced
Whether this variable is being calculated on a displaced system.
OutputType type
Definition: MooseTypes.h:257
libMesh::TensorTools::DecrementRank< OutputShape >::type OutputShapeDivergence
MooseArray< OutputSecond > FieldVariableSecond
const Elem *const & _elem
The current elem.
MooseArray< OutputDivergence > FieldVariableDivergence
const libMesh::FEType & _fe_type
Reference to the variable&#39;s finite element type.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
ElementType
Definition: MooseTypes.h:763
Base class for a system (of equations)
Definition: SystemBase.h:84
A structure for storing the various lists that contain the names of the items to be exported...
MooseArray< OutputType > FieldVariableCurl
MooseArray< OutputGradient > FieldVariableGradient
const MooseLinearVariableFV< OutputType > & _var
A const reference to the owning MooseLinearVariableFV object.
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:36
MooseArray< OutputType > FieldVariableValue
Moose::DOFType< OutputType >::type OutputData
void setGeometry(Moose::GeometryType gm_type)
Set the geometry type before calculating variables values.
const unsigned int _var_num
The index of the variable in the system.
void computeValues()
Compute the variable values.
void getDofIndices(const Elem *elem, std::vector< dof_id_type > &dof_indices) const
Get the dof indices for an element.
libMesh::TensorTools::DecrementRank< OutputType >::type OutputDivergence
libMesh::TensorTools::IncrementRank< OutputShapeGradient >::type OutputShapeSecond
const libMesh::QBase * _qrule
Pointer to the quadrature rule.
bool hasDoFsOnNodes() const override
Whether this data is associated with a variable that has DoFs on nodes.
Moose::ShapeType< OutputType >::type OutputShape
const TimeIntegrator *const _time_integrator
Pointer to time integrator.
libMesh::TensorTools::IncrementRank< OutputGradient >::type OutputSecond
Class holding the data members for linear finite volume variables.
libMesh::FEContinuity getContinuity() const override
Return the variable continuity.
Base class for time integrators.
const Assembly & _assembly
Reference to the system assembly of the variable.
MooseArray< OutputData > DoFValue
GeometryType
Definition: MooseTypes.h:248
void setDofValue(const OutputData &value, unsigned int index)
Set local DOF value at index to value .
virtual const MooseLinearVariableFV< OutputType > & var() const override
Get the corresponding variable.
const Elem * _prev_elem
used to keep track of when dof indices are out of date
libMesh::TensorTools::IncrementRank< OutputType >::type OutputGradient
This class provides variable solution values for other classes/objects to bind to when looping over f...
std::vector< dof_id_type > _dof_indices
The dof indices for the current element.
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 interface for linear finite volume problems.
Definition: FVUtils.h:24
libMesh::TensorTools::IncrementRank< OutputShape >::type OutputShapeGradient
void setDofValues(const DenseVector< OutputData > &values)
Set local DOF values to the entries of values .
unsigned int THREAD_ID
Definition: MooseTypes.h:209
const std::vector< dof_id_type > & dofIndices() const
Get the dof indices of the current element.