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 
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 setDofValues(const DenseVector<DofValue> & values);
102 
106  void setDofValue(const DofValue & value, unsigned int index);
107 
113  void getDofIndices(const Elem * elem, std::vector<dof_id_type> & dof_indices) const;
114 
118  const std::vector<dof_id_type> & dofIndices() const;
119 
123  unsigned int numberOfDofs() const;
124 
129  {
130  _dof_indices.clear();
131  _prev_elem = nullptr;
132  }
133 
134 protected:
138  virtual const MooseLinearVariableFV<OutputType> & var() const override;
139 
140 private:
141  void initializeSolnVars();
142 
145 
148 
150  const unsigned int _var_num;
151 
154 
157 
160 
164  const Elem * const & _elem;
165 
167  mutable const Elem * _prev_elem = nullptr;
168 
172  const std::vector<dof_id_type> & initDofIndices();
173 
175  const bool _displaced;
176 
179 
228 
229  friend void Moose::initDofIndices<>(MooseVariableDataLinearFV<OutputType> &, const Elem &);
230 };
231 
233 
234 template <typename OutputType>
235 const std::vector<dof_id_type> &
237 {
238  return const_cast<MooseVariableDataLinearFV<OutputType> *>(this)->initDofIndices();
239 }
240 
241 template <typename OutputType>
242 unsigned int
244 {
245  return dofIndices().size();
246 }
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:109
Moose::ElementType _element_type
The element type this object is storing data for. This is either Element, Neighbor, or Lower.
const bool _displaced
Whether this variable is being calculated on a displaced system.
OutputType type
Definition: MooseTypes.h:286
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:812
Base class for a system (of equations)
Definition: SystemBase.h:84
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
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.
Moose::DOFType< OutputType >::type DofValue
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.
GeometryType
Definition: MooseTypes.h:277
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
void setDofValue(const DofValue &value, unsigned int index)
Set local DOF value at index to value .
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
void setDofValues(const DenseVector< DofValue > &values)
Set local DOF values to the entries of values .
libMesh::TensorTools::IncrementRank< OutputShape >::type OutputShapeGradient
unsigned int THREAD_ID
Definition: MooseTypes.h:237
const std::vector< dof_id_type > & dofIndices() const
Get the dof indices of the current element.