Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
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. More...
 
 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. More...
 
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. More...
 
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
 

Private Attributes

const MooseMesh_mesh
 The mesh that this functor lives on. More...
 
const std::set< SubdomainID_sub_ids
 The subdomain IDs that this functor lives on. More...
 
const bool _extrapolated_boundary
 

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 MooseMesh & _mesh
The mesh that this functor lives on.
const std::string name
Definition: Setup.h:20

◆ 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.
const MooseMesh & _mesh
The mesh that this functor lives on.
MeshBase & mesh
const std::string name
Definition: Setup.h:20

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  try
150  {
151  return libmesh_map_find(*this, elem->id());
152  }
153  catch (libMesh::LogicError &)
154  {
155  if (!_sub_ids.empty() && !_sub_ids.count(elem->subdomain_id()))
156  mooseError("Attempted to evaluate CellCenteredMapFunctor '",
157  this->functorName(),
158  "' with an element subdomain id of '",
159  elem->subdomain_id(),
160  "' but that subdomain id is not one of the subdomain ids the functor is "
161  "restricted to.");
162  else
163  mooseError("Attempted access into CellCenteredMapFunctor '",
164  this->functorName(),
165  "' with a key that does not yet exist in the map. Make sure to fill your "
166  "CellCenteredMapFunctor for all elements you will attempt to access later.");
167  }
168 }
const std::set< SubdomainID > _sub_ids
The subdomain IDs that this functor lives on.
void mooseError(Args &&... args)
const MooseFunctorName & functorName() const

◆ 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 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 }
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)
bool hasBlocks(SubdomainID sub_id) const override
GradientType gradient(const ElemArg &elem, const StateArg &state) const

◆ evaluate() [4/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 }
void mooseError(Args &&... args)

◆ evaluate() [5/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 }
void mooseError(Args &&... args)

◆ 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 }
void mooseError(Args &&... args)

◆ 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 }
const MooseMesh & _mesh
The mesh that this functor lives on.
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 {
249  return Moose::FV::greenGaussGradient(face, state, *this, _extrapolated_boundary, _mesh);
250 }
const MooseMesh & _mesh
The mesh that this functor lives on.
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)

◆ hasBlocks() [1/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 }
const std::set< SubdomainID > _sub_ids
The subdomain IDs that this functor lives on.

◆ hasBlocks() [2/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 }
bool hasBlocks(SubdomainID sub_id) const override

◆ 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
bool hasBlocks(SubdomainID sub_id) const override

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