https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CellCenteredMapFunctor< T, Map > Class Template Reference

A functor whose evaluation relies on querying a map where the keys are element ids and the values correspond to the element/cell values. More...

#include <CellCenteredMapFunctor.h>

Inheritance diagram for CellCenteredMapFunctor< T, Map >:
[legend]

Public Types

using ElemArg = Moose::ElemArg
 
using FaceArg = Moose::FaceArg
 
using ElemQpArg = Moose::ElemQpArg
 
using ElemSideQpArg = Moose::ElemSideQpArg
 
using ElemPointArg = Moose::ElemPointArg
 
using StateArg = Moose::StateArg
 
using NodeArg = Moose::NodeArg
 
typedef FunctorBase< T > FunctorType
 
typedef T ValueType
 
typedef typename FunctorReturnType< T, FunctorEvaluationKind::Gradient >::type GradientType
 
typedef ValueType DotType
 

Public Member Functions

 CellCenteredMapFunctor (const MooseMesh &mesh, const std::string &name, const bool extrapolated_boundary)
 Use this constructor when you want the object to live everywhere on the mesh.
 
 CellCenteredMapFunctor (const MooseMesh &mesh, const std::set< SubdomainID > &sub_ids, const std::string &name, const bool extrapolated_boundary)
 Use this constructor if you want to potentially restrict this object to a specified set of subdomains/blocks.
 
bool isExtrapolatedBoundaryFace (const FaceInfo &fi, const Elem *elem, const StateArg &state) const override
 
bool hasBlocks (SubdomainID sub_id) const override
 
bool hasBlocks (const Elem *elem) const
 Checks whether we are defined on the provided element.
 
bool supportsFaceArg () const override final
 
bool supportsElemSideQpArg () const override final
 
FunctorReturnType< T, FET >::type genericEvaluate (const Space &r, const State &state) const
 
const MooseFunctorName & functorName () const
 
virtual void residualSetup () override
 
virtual void jacobianSetup () override
 
virtual void timestepSetup () override
 
virtual void customSetup (const ExecFlagType &exec_type) override
 
void setCacheClearanceSchedule (const std::set< ExecFlagType > &clearance_schedule)
 
bool isInternalFace (const FaceInfo &) const
 
virtual bool isConstant () const
 
virtual bool hasFaceSide (const FaceInfo &fi, const bool fi_elem_side) const override
 
void checkFace (const Moose::FaceArg &face) const
 
ValueType operator() (const ElemArg &elem, const StateArg &state) const
 
ValueType operator() (const FaceArg &face, const StateArg &state) const
 
ValueType operator() (const ElemQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemSideQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemPointArg &elem_point, const StateArg &state) const
 
ValueType operator() (const NodeArg &node, const StateArg &state) const
 
ValueType operator() (const PointArg &point, const StateArg &state) const
 
ValueType operator() (const ElemArg &elem, const StateArg &state) const
 
ValueType operator() (const FaceArg &face, const StateArg &state) const
 
ValueType operator() (const ElemQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemSideQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemPointArg &elem_point, const StateArg &state) const
 
ValueType operator() (const NodeArg &node, const StateArg &state) const
 
ValueType operator() (const PointArg &point, const StateArg &state) const
 
GradientType gradient (const ElemArg &elem, const StateArg &state) const
 
GradientType gradient (const FaceArg &face, const StateArg &state) const
 
GradientType gradient (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradient (const NodeArg &node, const StateArg &state) const
 
GradientType gradient (const PointArg &point, const StateArg &state) const
 
GradientType gradient (const ElemArg &elem, const StateArg &state) const
 
GradientType gradient (const FaceArg &face, const StateArg &state) const
 
GradientType gradient (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradient (const NodeArg &node, const StateArg &state) const
 
GradientType gradient (const PointArg &point, const StateArg &state) const
 
DotType dot (const ElemArg &elem, const StateArg &state) const
 
DotType dot (const FaceArg &face, const StateArg &state) const
 
DotType dot (const ElemQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemSideQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemPointArg &elem_point, const StateArg &state) const
 
DotType dot (const NodeArg &node, const StateArg &state) const
 
DotType dot (const PointArg &point, const StateArg &state) const
 
DotType dot (const ElemArg &elem, const StateArg &state) const
 
DotType dot (const FaceArg &face, const StateArg &state) const
 
DotType dot (const ElemQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemSideQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemPointArg &elem_point, const StateArg &state) const
 
DotType dot (const NodeArg &node, const StateArg &state) const
 
DotType dot (const PointArg &point, const StateArg &state) const
 
GradientType gradDot (const ElemArg &elem, const StateArg &state) const
 
GradientType gradDot (const FaceArg &face, const StateArg &state) const
 
GradientType gradDot (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradDot (const NodeArg &node, const StateArg &state) const
 
GradientType gradDot (const PointArg &point, const StateArg &state) const
 
GradientType gradDot (const ElemArg &elem, const StateArg &state) const
 
GradientType gradDot (const FaceArg &face, const StateArg &state) const
 
GradientType gradDot (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradDot (const NodeArg &node, const StateArg &state) const
 
GradientType gradDot (const PointArg &point, const StateArg &state) const
 

Protected Member Functions

virtual ValueType evaluate (const PointArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const NodeArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const PointArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemArg &, const StateArg &) const
 
virtual DotType evaluateDot (const FaceArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemQpArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemSideQpArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemPointArg &, const StateArg &) const
 
virtual DotType evaluateDot (const NodeArg &, const StateArg &) const
 
virtual DotType evaluateDot (const PointArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemArg &, const StateArg &) const
 
virtual DotType evaluateDot (const FaceArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemQpArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemSideQpArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemPointArg &, const StateArg &) const
 
virtual DotType evaluateDot (const NodeArg &, const StateArg &) const
 
virtual DotType evaluateDot (const PointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const NodeArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const PointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const NodeArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const PointArg &, const StateArg &) const
 

Private Member Functions

ValueType evaluate (const ElemArg &elem_arg, const StateArg &) const override
 
ValueType evaluate (const ElemPointArg &elem_point, const StateArg &state) const override
 
ValueType evaluate (const FaceArg &face, const StateArg &) const override
 
ValueType evaluate (const ElemQpArg &, const StateArg &) const override
 
ValueType evaluate (const ElemSideQpArg &, const StateArg &) const override
 
ValueType evaluate (const NodeArg &elem_arg, const StateArg &) const override
 
GradientType evaluateGradient (const ElemArg &elem_arg, const StateArg &state) const override
 
GradientType evaluateGradient (const FaceArg &face, const StateArg &state) const override
 
void clearCacheData ()
 
ValueType queryQpCache (unsigned int qp, const libMesh::QBase &qrule, std::vector< std::pair< bool, T > > &qp_cache_data, const SpaceArg &space, const StateArg &state) const
 
ValueType queryFVArgCache (std::map< SpaceArg, ValueType > &cache_data, const SpaceArg &space) const
 

Private Attributes

const MooseMesh & _mesh
 The mesh that this functor lives on.
 
const std::set< SubdomainID > _sub_ids
 The subdomain IDs that this functor lives on.
 
const bool _extrapolated_boundary
 
std::set< ExecFlagType > _clearance_schedule
 
bool _always_evaluate
 
dof_id_type _current_qp_map_key
 
std::vector< std::pair< bool, ValueType > > * _current_qp_map_value
 
std::unordered_map< dof_id_type, std::vector< std::pair< bool, ValueType > > > _qp_to_value
 
dof_id_type _current_side_qp_map_key
 
std::vector< std::vector< std::pair< bool, ValueType > > > * _current_side_qp_map_value
 
std::unordered_map< dof_id_type, std::vector< std::vector< std::pair< bool, ValueType > > > > _side_qp_to_value
 
std::map< ElemArg, ValueType > _elem_arg_to_value
 
std::map< FaceArg, ValueType > _face_arg_to_value
 
std::map< NodeArg, ValueType > _node_arg_to_value
 
MooseFunctorName _functor_name
 

Detailed Description

template<typename T, typename Map>
class CellCenteredMapFunctor< T, Map >

A functor whose evaluation relies on querying a map where the keys are element ids and the values correspond to the element/cell values.

This is a very useful data type for storing the result of (possibly repeated) interpolation and reconstruction

Definition at line 26 of file CellCenteredMapFunctor.h.

Member Typedef Documentation

◆ ElemArg

template<typename T , typename Map >
using CellCenteredMapFunctor< T, Map >::ElemArg = Moose::ElemArg

Definition at line 32 of file CellCenteredMapFunctor.h.

◆ ElemPointArg

template<typename T , typename Map >
using CellCenteredMapFunctor< T, Map >::ElemPointArg = Moose::ElemPointArg

Definition at line 36 of file CellCenteredMapFunctor.h.

◆ ElemQpArg

template<typename T , typename Map >
using CellCenteredMapFunctor< T, Map >::ElemQpArg = Moose::ElemQpArg

Definition at line 34 of file CellCenteredMapFunctor.h.

◆ ElemSideQpArg

template<typename T , typename Map >
using CellCenteredMapFunctor< T, Map >::ElemSideQpArg = Moose::ElemSideQpArg

Definition at line 35 of file CellCenteredMapFunctor.h.

◆ FaceArg

template<typename T , typename Map >
using CellCenteredMapFunctor< T, Map >::FaceArg = Moose::FaceArg

Definition at line 33 of file CellCenteredMapFunctor.h.

◆ NodeArg

template<typename T , typename Map >
using CellCenteredMapFunctor< T, Map >::NodeArg = Moose::NodeArg

Definition at line 38 of file CellCenteredMapFunctor.h.

◆ StateArg

template<typename T , typename Map >
using CellCenteredMapFunctor< T, Map >::StateArg = Moose::StateArg

Definition at line 37 of file CellCenteredMapFunctor.h.

Constructor & Destructor Documentation

◆ CellCenteredMapFunctor() [1/2]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::CellCenteredMapFunctor ( const MooseMesh &  mesh,
const std::string &  name,
const bool  extrapolated_boundary 
)

Use this constructor when you want the object to live everywhere on the mesh.

Definition at line 93 of file CellCenteredMapFunctor.h.

96 : Moose::FunctorBase<T>(name), _mesh(mesh), _extrapolated_boundary(extrapolated_boundary)
97{
98}
const std::string name
Definition Setup.h:21
const MooseMesh & _mesh
The mesh that this functor lives on.

◆ CellCenteredMapFunctor() [2/2]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::CellCenteredMapFunctor ( const MooseMesh &  mesh,
const std::set< SubdomainID > &  sub_ids,
const std::string &  name,
const bool  extrapolated_boundary 
)

Use this constructor if you want to potentially restrict this object to a specified set of subdomains/blocks.

Definition at line 101 of file CellCenteredMapFunctor.h.

106 _mesh(mesh),
107 _sub_ids(sub_ids == mesh.meshSubdomains() ? std::set<SubdomainID>() : sub_ids),
108 _extrapolated_boundary(extrapolated_boundary)
109{
110}
const std::set< SubdomainID > _sub_ids
The subdomain IDs that this functor lives on.
MeshBase & mesh

Member Function Documentation

◆ evaluate() [1/6]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::ValueType CellCenteredMapFunctor< T, Map >::evaluate ( const ElemArg &  elem_arg,
const StateArg &   
) const
overrideprivatevirtual

Implements Moose::FunctorBase< T >.

Definition at line 146 of file CellCenteredMapFunctor.h.

147{
148 const Elem * const elem = elem_arg.elem;
149
150 auto it = this->find(elem->id());
151 if (it == this->end())
152 {
153 if (!_sub_ids.empty() && !_sub_ids.count(elem->subdomain_id()))
154 mooseError("Attempted to evaluate CellCenteredMapFunctor '",
155 this->functorName(),
156 "' with an element subdomain id of '",
157 elem->subdomain_id(),
158 "' but that subdomain id is not one of the subdomain ids the functor is "
159 "restricted to.");
160 else
161 mooseError("Attempted access into CellCenteredMapFunctor '",
162 this->functorName(),
163 "' with a key that does not yet exist in the map. Make sure to fill your "
164 "CellCenteredMapFunctor for all elements you will attempt to access later.");
165 }
166
167 return it->second;
168}
void mooseError(Args &&... args)
const MooseFunctorName & functorName() const
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)

◆ evaluate() [2/6]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::ValueType CellCenteredMapFunctor< T, Map >::evaluate ( const ElemPointArg &  elem_point,
const StateArg &  state 
) const
overrideprivatevirtual

Implements Moose::FunctorBase< T >.

Definition at line 172 of file CellCenteredMapFunctor.h.

174{
175 return (*this)(elem_point.makeElem(), state) +
176 (elem_point.point - elem_point.elem->vertex_average()) *
177 this->gradient(elem_point.makeElem(), state);
178}
GradientType gradient(const ElemArg &elem, const StateArg &state) const

◆ evaluate() [3/6]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::ValueType CellCenteredMapFunctor< T, Map >::evaluate ( const ElemQpArg &  ,
const StateArg &   
) const
overrideprivatevirtual

Implements Moose::FunctorBase< T >.

Definition at line 218 of file CellCenteredMapFunctor.h.

219{
220 mooseError("not implemented");
221}

◆ evaluate() [4/6]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::ValueType CellCenteredMapFunctor< T, Map >::evaluate ( const ElemSideQpArg &  ,
const StateArg &   
) const
overrideprivatevirtual

Implements Moose::FunctorBase< T >.

Definition at line 225 of file CellCenteredMapFunctor.h.

226{
227 mooseError("not implemented");
228}

◆ evaluate() [5/6]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::ValueType CellCenteredMapFunctor< T, Map >::evaluate ( const FaceArg &  face,
const StateArg &  state 
) const
overrideprivatevirtual

Implements Moose::FunctorBase< T >.

Definition at line 182 of file CellCenteredMapFunctor.h.

183{
184 const auto & fi = *face.fi;
185 mooseAssert(face.limiter_type == Moose::FV::LimiterType::CentralDifference,
186 "this implementation currently only supports linear interpolations");
187
188 const bool defined_on_elem = hasBlocks(&fi.elem());
189 const bool defined_on_neighbor = hasBlocks(fi.neighborPtr());
190 if (defined_on_elem && defined_on_neighbor)
191 return Moose::FV::linearInterpolation(*this, face, state);
192
193 if (defined_on_elem)
194 {
195 const auto elem_arg = face.makeElem();
196 const auto elem_value = (*this)(elem_arg, state);
198 return elem_value;
199 // Two term expansion
200 return elem_value + this->gradient(elem_arg, state) * (fi.faceCentroid() - fi.elemCentroid());
201 }
202 else
203 {
204 mooseAssert(defined_on_neighbor, "We should be defined on one of the sides");
205 const auto neighbor_arg = face.makeNeighbor();
206 const auto neighbor_value = (*this)(neighbor_arg, state);
208 return neighbor_value;
209
210 // Two term expansion
211 return neighbor_value +
212 this->gradient(neighbor_arg, state) * (fi.faceCentroid() - fi.neighborCentroid());
213 }
214}
bool hasBlocks(SubdomainID sub_id) const override
libMesh::CompareTypes< T, T2 >::supertype linearInterpolation(const T &value1, const T2 &value2, const FaceInfo &fi, const bool one_is_elem, const InterpMethod interp_method=InterpMethod::Average)

◆ evaluate() [6/6]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::ValueType CellCenteredMapFunctor< T, Map >::evaluate ( const NodeArg &  elem_arg,
const StateArg &   
) const
overrideprivatevirtual

Implements Moose::FunctorBase< T >.

Definition at line 232 of file CellCenteredMapFunctor.h.

233{
234 mooseError("not implemented");
235}

◆ evaluateGradient() [1/2]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::GradientType CellCenteredMapFunctor< T, Map >::evaluateGradient ( const ElemArg &  elem_arg,
const StateArg &  state 
) const
overrideprivatevirtual

Reimplemented from Moose::FunctorBase< T >.

Definition at line 239 of file CellCenteredMapFunctor.h.

241{
242 return Moose::FV::greenGaussGradient(elem_arg, state, *this, _extrapolated_boundary, _mesh);
243}
libMesh::VectorValue< T > greenGaussGradient(const ElemArg &elem_arg, const StateArg &state_arg, const FunctorBase< T > &functor, const bool two_term_boundary_expansion, const MooseMesh &mesh, const bool force_green_gauss=false)

◆ evaluateGradient() [2/2]

template<typename T , typename Map >
CellCenteredMapFunctor< T, Map >::GradientType CellCenteredMapFunctor< T, Map >::evaluateGradient ( const FaceArg &  face,
const StateArg &  state 
) const
overrideprivatevirtual

Reimplemented from Moose::FunctorBase< T >.

Definition at line 247 of file CellCenteredMapFunctor.h.

248{
250}

◆ hasBlocks() [1/2]

template<typename T , typename Map >
bool CellCenteredMapFunctor< T, Map >::hasBlocks ( const Elem *  elem) const

Checks whether we are defined on the provided element.

Definition at line 129 of file CellCenteredMapFunctor.h.

130{
131 if (!elem)
132 return false;
133
134 return hasBlocks(elem->subdomain_id());
135}

◆ hasBlocks() [2/2]

template<typename T , typename Map >
bool CellCenteredMapFunctor< T, Map >::hasBlocks ( SubdomainID  sub_id) const
overridevirtual

Reimplemented from Moose::FunctorBase< T >.

Definition at line 139 of file CellCenteredMapFunctor.h.

140{
141 return _sub_ids.empty() || _sub_ids.count(sub_id);
142}

◆ isExtrapolatedBoundaryFace()

template<typename T , typename Map >
bool CellCenteredMapFunctor< T, Map >::isExtrapolatedBoundaryFace ( const FaceInfo &  fi,
const Elem *  elem,
const StateArg &  state 
) const
overridevirtual

Reimplemented from Moose::FunctorBase< T >.

Definition at line 114 of file CellCenteredMapFunctor.h.

117{
118 const bool defined_on_elem = hasBlocks(&fi.elem());
119 const bool defined_on_neighbor = hasBlocks(fi.neighborPtr());
120 const bool extrapolated = (defined_on_elem + defined_on_neighbor) == 1;
121
122 mooseAssert(defined_on_elem || defined_on_neighbor,
123 "This shouldn't be called if we aren't defined on either side.");
124 return extrapolated;
125}
const Elem & elem() const
const Elem * neighborPtr() const

◆ supportsElemSideQpArg()

template<typename T , typename Map >
bool CellCenteredMapFunctor< T, Map >::supportsElemSideQpArg ( ) const
inlinefinaloverridevirtual

Implements Moose::FunctorBase< T >.

Definition at line 67 of file CellCenteredMapFunctor.h.

67{ return false; }

◆ supportsFaceArg()

template<typename T , typename Map >
bool CellCenteredMapFunctor< T, Map >::supportsFaceArg ( ) const
inlinefinaloverridevirtual

Implements Moose::FunctorBase< T >.

Definition at line 66 of file CellCenteredMapFunctor.h.

66{ return true; }

Member Data Documentation

◆ _extrapolated_boundary

template<typename T , typename Map >
const bool CellCenteredMapFunctor< T, Map >::_extrapolated_boundary
private

Definition at line 77 of file CellCenteredMapFunctor.h.

◆ _mesh

template<typename T , typename Map >
const MooseMesh& CellCenteredMapFunctor< T, Map >::_mesh
private

The mesh that this functor lives on.

Definition at line 71 of file CellCenteredMapFunctor.h.

◆ _sub_ids

template<typename T , typename Map >
const std::set<SubdomainID> CellCenteredMapFunctor< T, Map >::_sub_ids
private

The subdomain IDs that this functor lives on.

If empty, then we consider the functor to live on all subdomains

Definition at line 75 of file CellCenteredMapFunctor.h.


The documentation for this class was generated from the following file: