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< TFunctorType
 
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 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
 
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 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
 
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 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
 
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 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
 

Protected Member Functions

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 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 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 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 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
 

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 92 of file CellCenteredMapFunctor.h.

95 : Moose::FunctorBase<T>(name), _mesh(mesh), _extrapolated_boundary(extrapolated_boundary)
96{
97}
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 100 of file CellCenteredMapFunctor.h.

105 _mesh(mesh),
106 _sub_ids(sub_ids == mesh.meshSubdomains() ? std::set<SubdomainID>() : sub_ids),
107 _extrapolated_boundary(extrapolated_boundary)
108{
109}
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 145 of file CellCenteredMapFunctor.h.

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

173{
174 return (*this)(elem_point.makeElem(), state) +
175 (elem_point.point - elem_point.elem->vertex_average()) *
176 this->gradient(elem_point.makeElem(), state);
177}
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 217 of file CellCenteredMapFunctor.h.

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

◆ 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 224 of file CellCenteredMapFunctor.h.

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

◆ 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 181 of file CellCenteredMapFunctor.h.

182{
183 const auto & fi = *face.fi;
184 mooseAssert(face.limiter_type == Moose::FV::LimiterType::CentralDifference,
185 "this implementation currently only supports linear interpolations");
186
187 const bool defined_on_elem = hasBlocks(&fi.elem());
188 const bool defined_on_neighbor = hasBlocks(fi.neighborPtr());
189 if (defined_on_elem && defined_on_neighbor)
190 return Moose::FV::linearInterpolation(*this, face, state);
191
192 if (defined_on_elem)
193 {
194 const auto elem_arg = face.makeElem();
195 const auto elem_value = (*this)(elem_arg, state);
197 return elem_value;
198 // Two term expansion
199 return elem_value + this->gradient(elem_arg, state) * (fi.faceCentroid() - fi.elemCentroid());
200 }
201 else
202 {
203 mooseAssert(defined_on_neighbor, "We should be defined on one of the sides");
204 const auto neighbor_arg = face.makeNeighbor();
205 const auto neighbor_value = (*this)(neighbor_arg, state);
207 return neighbor_value;
208
209 // Two term expansion
210 return neighbor_value +
211 this->gradient(neighbor_arg, state) * (fi.faceCentroid() - fi.neighborCentroid());
212 }
213}
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 231 of file CellCenteredMapFunctor.h.

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

◆ 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 238 of file CellCenteredMapFunctor.h.

240{
241 return Moose::FV::greenGaussGradient(elem_arg, state, *this, _extrapolated_boundary, _mesh);
242}
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 246 of file CellCenteredMapFunctor.h.

247{
249}

◆ 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 128 of file CellCenteredMapFunctor.h.

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

◆ 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 138 of file CellCenteredMapFunctor.h.

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

◆ 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 113 of file CellCenteredMapFunctor.h.

116{
117 const bool defined_on_elem = hasBlocks(&fi.elem());
118 const bool defined_on_neighbor = hasBlocks(fi.neighborPtr());
119 const bool extrapolated = (defined_on_elem + defined_on_neighbor) == 1;
120
121 mooseAssert(defined_on_elem || defined_on_neighbor,
122 "This shouldn't be called if we aren't defined on either side.");
123 return extrapolated;
124}
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: