Base class for piecewise linear slope reconstruction to get the slopes of element average variables.
More...
#include <SlopeReconstructionBase.h>
|
| SlopeReconstructionBase (const InputParameters ¶meters) |
|
virtual void | initialize () |
|
virtual void | finalize () |
|
virtual void | computeElement () |
|
virtual const std::vector< RealGradient > & | getElementSlope (dof_id_type elementid) const |
| accessor function call to get element slope values More...
|
|
virtual const std::vector< Real > & | getElementAverageValue (dof_id_type elementid) const |
| accessor function call to get element average variable values More...
|
|
virtual const std::vector< Real > & | getBoundaryAverageValue (dof_id_type elementid, unsigned int side) const |
| accessor function call to get boundary average variable values More...
|
|
virtual const Point & | getSideCentroid (dof_id_type elementid, dof_id_type neighborid) const |
| accessor function call to get cached internal side centroid More...
|
|
virtual const Point & | getBoundarySideCentroid (dof_id_type elementid, unsigned int side) const |
| accessor function call to get cached boundary side centroid More...
|
|
virtual const Point & | getSideNormal (dof_id_type elementid, dof_id_type neighborid) const |
| accessor function call to get cached internal side normal More...
|
|
virtual const Point & | getBoundarySideNormal (dof_id_type elementid, unsigned int side) const |
| accessor function call to get cached boundary side centroid More...
|
|
virtual const Real & | getSideArea (dof_id_type elementid, dof_id_type neighborid) const |
| accessor function call to get cached internal side area More...
|
|
virtual const Real & | getBoundarySideArea (dof_id_type elementid, unsigned int side) const |
| accessor function call to get cached boundary side area More...
|
|
virtual void | reconstructElementSlope ()=0 |
| compute the slope of the cell More...
|
|
virtual void | meshChanged () |
|
virtual void | execute () |
|
virtual void | pre () |
|
virtual void | preElement (const Elem *elem) |
|
virtual void | onElement (const Elem *elem) |
|
virtual void | onBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id) |
|
virtual void | onInternalSide (const Elem *elem, unsigned int side) |
|
virtual void | onInterface (const Elem *elem, unsigned int side, BoundaryID bnd_id) |
|
virtual void | post () |
|
virtual void | subdomainChanged () |
|
virtual bool | keepGoing () |
|
void | join (const ElementLoopUserObject &) |
|
|
std::map< dof_id_type, std::vector< RealGradient > > & | _rslope |
| store the reconstructed slopes into this map indexed by element ID More...
|
|
std::map< dof_id_type, std::vector< Real > > & | _avars |
| store the average variable values into this map indexed by element ID More...
|
|
std::map< std::pair< dof_id_type, unsigned int >, std::vector< Real > > & | _bnd_avars |
| store the boundary average variable values into this map indexed by pair of element ID and local side ID More...
|
|
std::map< std::pair< dof_id_type, dof_id_type >, Point > & | _side_centroid |
| store the side centroid into this map indexed by pair of element ID and neighbor ID More...
|
|
std::map< std::pair< dof_id_type, unsigned int >, Point > & | _bnd_side_centroid |
| store the boundary side centroid into this map indexed by pair of element ID and local side ID More...
|
|
std::map< std::pair< dof_id_type, dof_id_type >, Real > & | _side_area |
| store the side area into this map indexed by pair of element ID and neighbor ID More...
|
|
std::map< std::pair< dof_id_type, unsigned int >, Real > & | _bnd_side_area |
| store the boundary side area into this map indexed by pair of element ID and local side ID More...
|
|
std::map< std::pair< dof_id_type, dof_id_type >, Point > & | _side_normal |
| store the side normal into this map indexed by pair of element ID and neighbor ID More...
|
|
std::map< std::pair< dof_id_type, unsigned int >, Point > & | _bnd_side_normal |
| store the boundary side normal into this map indexed by pair of element ID and local side ID More...
|
|
const MooseArray< Point > & | _q_point_face |
| required data for face assembly More...
|
|
const QBase *const & | _qrule_face |
|
const MooseArray< Real > & | _JxW_face |
|
const MooseArray< Point > & | _normals_face |
|
const unsigned int & | _side |
| current side of the current element More...
|
|
const Elem *const & | _side_elem |
|
const Real & | _side_volume |
|
const Elem *const & | _neighbor_elem |
| the neighboring element More...
|
|
bool | _side_geoinfo_cached |
| flag to indicated if side geometry info is cached More...
|
|
MooseMesh & | _mesh |
|
const Elem * | _current_elem |
|
const Real & | _current_elem_volume |
|
unsigned int | _current_side |
|
const Elem * | _current_neighbor |
|
const MooseArray< Point > & | _q_point |
|
const QBase *const & | _qrule |
|
const MooseArray< Real > & | _JxW |
|
const MooseArray< Real > & | _coord |
|
bool | _have_interface_elems |
| true if we have cached interface elements, false if they need to be cached. We want to (re)cache only when mesh changed More...
|
|
std::set< dof_id_type > | _interface_elem_ids |
| List of element IDs that are on the processor boundary and need to be send to other processors. More...
|
|
SubdomainID | _subdomain |
| The subdomain for the current element. More...
|
|
SubdomainID | _old_subdomain |
| The subdomain for the last element. More...
|
|
|
static Threads::spin_mutex | _mutex |
|
Base class for piecewise linear slope reconstruction to get the slopes of element average variables.
Definition at line 25 of file SlopeReconstructionBase.h.
◆ SlopeReconstructionBase()
SlopeReconstructionBase::SlopeReconstructionBase |
( |
const InputParameters & |
parameters | ) |
|
Definition at line 25 of file SlopeReconstructionBase.C.
27 _rslope(declareRestartableData<std::map<dof_id_type, std::vector<RealGradient>>>(
28 "reconstructed_slopes")),
29 _avars(declareRestartableData<std::map<dof_id_type, std::vector<Real>>>(
"avg_var_values")),
31 declareRestartableData<std::map<std::pair<dof_id_type, unsigned int>, std::vector<Real>>>(
32 "avg_bnd_var_values")),
33 _side_centroid(declareRestartableData<std::map<std::pair<dof_id_type, dof_id_type>, Point>>(
36 declareRestartableData<std::map<std::pair<dof_id_type, unsigned int>, Point>>(
37 "bnd_side_centroid")),
39 declareRestartableData<std::map<std::pair<dof_id_type, dof_id_type>, Real>>(
"side_area")),
40 _bnd_side_area(declareRestartableData<std::map<std::pair<dof_id_type, unsigned int>, Real>>(
42 _side_normal(declareRestartableData<std::map<std::pair<dof_id_type, dof_id_type>, Point>>(
44 _bnd_side_normal(declareRestartableData<std::map<std::pair<dof_id_type, unsigned int>, Point>>(
50 _side(_assembly.side()),
◆ caughtMooseException()
void ElementLoopUserObject::caughtMooseException |
( |
MooseException & |
e | ) |
|
|
protectedvirtualinherited |
◆ computeBoundary()
void ElementLoopUserObject::computeBoundary |
( |
| ) |
|
|
protectedvirtualinherited |
◆ computeElement()
void SlopeReconstructionBase::computeElement |
( |
| ) |
|
|
virtual |
◆ computeInterface()
void ElementLoopUserObject::computeInterface |
( |
| ) |
|
|
protectedvirtualinherited |
◆ computeInternalSide()
void ElementLoopUserObject::computeInternalSide |
( |
| ) |
|
|
protectedvirtualinherited |
◆ deserialize()
void SlopeReconstructionBase::deserialize |
( |
std::vector< std::string > & |
serialized_buffers | ) |
|
|
protectedvirtual |
Definition at line 283 of file SlopeReconstructionBase.C.
286 std::istringstream iss;
288 mooseAssert(serialized_buffers.size() == _app.n_processors(),
289 "Unexpected size of serialized_buffers: " << serialized_buffers.size());
291 for (
auto rank = decltype(_app.n_processors())(0); rank < serialized_buffers.size(); ++rank)
293 if (rank == processor_id())
296 iss.str(serialized_buffers[rank]);
301 unsigned int size = 0;
302 iss.read((
char *)&size,
sizeof(size));
304 for (
unsigned int i = 0; i < size; i++)
307 loadHelper(iss, key,
this);
309 std::vector<RealGradient> value;
310 loadHelper(iss, value,
this);
313 _rslope.insert(std::pair<dof_id_type, std::vector<RealGradient>>(key, value));
Referenced by finalize().
◆ execute()
void ElementLoopUserObject::execute |
( |
| ) |
|
|
virtualinherited |
Definition at line 75 of file ElementLoopUserObject.C.
77 ConstElemRange & elem_range = *
_mesh.getActiveLocalElementRange();
83 _subdomain = std::numeric_limits<SubdomainID>::max();
84 ConstElemRange::const_iterator el = elem_range.begin();
85 for (el = elem_range.begin(); el != elem_range.end(); ++el)
90 const Elem * elem = *el;
91 unsigned int cur_subdomain = elem->subdomain_id();
104 for (
unsigned int side = 0; side < elem->n_sides(); side++)
106 std::vector<BoundaryID> boundary_ids =
_mesh.getBoundaryIDs(elem, side);
108 if (boundary_ids.size() > 0)
109 for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
110 it != boundary_ids.end();
114 if (elem->neighbor_ptr(side) != NULL)
116 if (this->hasBlocks(elem->neighbor_ptr(side)->subdomain_id()))
118 if (boundary_ids.size() > 0)
119 for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
120 it != boundary_ids.end();
130 catch (MooseException & e)
◆ finalize()
void SlopeReconstructionBase::finalize |
( |
| ) |
|
|
virtual |
Reimplemented from ElementLoopUserObject.
Definition at line 68 of file SlopeReconstructionBase.C.
72 if (_app.n_processors() > 1)
76 std::vector<std::string> send_buffers(1);
77 std::vector<std::string> recv_buffers;
79 recv_buffers.reserve(_app.n_processors());
81 comm().allgather_packed_range((
void *)(
nullptr),
84 std::back_inserter(recv_buffers));
◆ getBoundaryAverageValue()
const std::vector< Real > & SlopeReconstructionBase::getBoundaryAverageValue |
( |
dof_id_type |
elementid, |
|
|
unsigned int |
side |
|
) |
| const |
|
virtual |
accessor function call to get boundary average variable values
Definition at line 132 of file SlopeReconstructionBase.C.
134 Threads::spin_mutex::scoped_lock lock(
_mutex);
135 std::map<std::pair<dof_id_type, unsigned int>, std::vector<Real>>::const_iterator pos =
136 _bnd_avars.find(std::pair<dof_id_type, unsigned int>(elementid, side));
139 mooseError(
"Average variable values are not cached for element id '",
◆ getBoundarySideArea()
const Real & SlopeReconstructionBase::getBoundarySideArea |
( |
dof_id_type |
elementid, |
|
|
unsigned int |
side |
|
) |
| const |
|
virtual |
accessor function call to get cached boundary side area
Definition at line 240 of file SlopeReconstructionBase.C.
242 Threads::spin_mutex::scoped_lock lock(
_mutex);
243 std::map<std::pair<dof_id_type, unsigned int>, Real>::const_iterator pos =
244 _bnd_side_area.find(std::pair<dof_id_type, unsigned int>(elementid, side));
247 mooseError(
"Boundary side area values are not cached for element id '",
◆ getBoundarySideCentroid()
const Point & SlopeReconstructionBase::getBoundarySideCentroid |
( |
dof_id_type |
elementid, |
|
|
unsigned int |
side |
|
) |
| const |
|
virtual |
accessor function call to get cached boundary side centroid
Definition at line 168 of file SlopeReconstructionBase.C.
170 Threads::spin_mutex::scoped_lock lock(
_mutex);
171 std::map<std::pair<dof_id_type, unsigned int>, Point>::const_iterator pos =
175 mooseError(
"Boundary side centroid values are not cached for element id '",
◆ getBoundarySideNormal()
const Point & SlopeReconstructionBase::getBoundarySideNormal |
( |
dof_id_type |
elementid, |
|
|
unsigned int |
side |
|
) |
| const |
|
virtual |
accessor function call to get cached boundary side centroid
Definition at line 204 of file SlopeReconstructionBase.C.
206 Threads::spin_mutex::scoped_lock lock(
_mutex);
207 std::map<std::pair<dof_id_type, unsigned int>, Point>::const_iterator pos =
208 _bnd_side_normal.find(std::pair<dof_id_type, unsigned int>(elementid, side));
211 mooseError(
"Boundary side normal values are not cached for element id '",
◆ getElementAverageValue()
const std::vector< Real > & SlopeReconstructionBase::getElementAverageValue |
( |
dof_id_type |
elementid | ) |
const |
|
virtual |
accessor function call to get element average variable values
Definition at line 117 of file SlopeReconstructionBase.C.
119 Threads::spin_mutex::scoped_lock lock(
_mutex);
120 std::map<dof_id_type, std::vector<Real>>::const_iterator pos =
_avars.find(elementid);
123 mooseError(
"Average variable values are not cached for element id '",
◆ getElementSlope()
const std::vector< RealGradient > & SlopeReconstructionBase::getElementSlope |
( |
dof_id_type |
elementid | ) |
const |
|
virtual |
accessor function call to get element slope values
Definition at line 104 of file SlopeReconstructionBase.C.
106 Threads::spin_mutex::scoped_lock lock(
_mutex);
107 std::map<dof_id_type, std::vector<RealGradient>>::const_iterator pos =
_rslope.find(elementid);
111 "Reconstructed slope is not cached for element id '", elementid,
"' in ", __FUNCTION__);
◆ getSideArea()
const Real & SlopeReconstructionBase::getSideArea |
( |
dof_id_type |
elementid, |
|
|
dof_id_type |
neighborid |
|
) |
| const |
|
virtual |
accessor function call to get cached internal side area
Definition at line 222 of file SlopeReconstructionBase.C.
224 Threads::spin_mutex::scoped_lock lock(
_mutex);
225 std::map<std::pair<dof_id_type, dof_id_type>, Real>::const_iterator pos =
226 _side_area.find(std::pair<dof_id_type, dof_id_type>(elementid, neighborid));
229 mooseError(
"Side area values are not cached for element id '",
231 "' and neighbor id '",
◆ getSideCentroid()
const Point & SlopeReconstructionBase::getSideCentroid |
( |
dof_id_type |
elementid, |
|
|
dof_id_type |
neighborid |
|
) |
| const |
|
virtual |
accessor function call to get cached internal side centroid
Definition at line 150 of file SlopeReconstructionBase.C.
152 Threads::spin_mutex::scoped_lock lock(
_mutex);
153 std::map<std::pair<dof_id_type, dof_id_type>, Point>::const_iterator pos =
154 _side_centroid.find(std::pair<dof_id_type, dof_id_type>(elementid, neighborid));
157 mooseError(
"Side centroid values are not cached for element id '",
159 "' and neighbor id '",
◆ getSideNormal()
const Point & SlopeReconstructionBase::getSideNormal |
( |
dof_id_type |
elementid, |
|
|
dof_id_type |
neighborid |
|
) |
| const |
|
virtual |
accessor function call to get cached internal side normal
Definition at line 186 of file SlopeReconstructionBase.C.
188 Threads::spin_mutex::scoped_lock lock(
_mutex);
189 std::map<std::pair<dof_id_type, dof_id_type>, Point>::const_iterator pos =
190 _side_normal.find(std::pair<dof_id_type, dof_id_type>(elementid, neighborid));
193 mooseError(
"Side normal values are not cached for element id '",
195 "' and neighbor id '",
◆ initialize()
void SlopeReconstructionBase::initialize |
( |
| ) |
|
|
virtual |
◆ join()
◆ keepGoing()
virtual bool ElementLoopUserObject::keepGoing |
( |
| ) |
|
|
inlinevirtualinherited |
◆ meshChanged()
void SlopeReconstructionBase::meshChanged |
( |
| ) |
|
|
virtual |
◆ onBoundary()
void ElementLoopUserObject::onBoundary |
( |
const Elem * |
elem, |
|
|
unsigned int |
side, |
|
|
BoundaryID |
bnd_id |
|
) |
| |
|
virtualinherited |
◆ onElement()
void ElementLoopUserObject::onElement |
( |
const Elem * |
elem | ) |
|
|
virtualinherited |
◆ onInterface()
void ElementLoopUserObject::onInterface |
( |
const Elem * |
elem, |
|
|
unsigned int |
side, |
|
|
BoundaryID |
bnd_id |
|
) |
| |
|
virtualinherited |
◆ onInternalSide()
void ElementLoopUserObject::onInternalSide |
( |
const Elem * |
elem, |
|
|
unsigned int |
side |
|
) |
| |
|
virtualinherited |
◆ post()
void ElementLoopUserObject::post |
( |
| ) |
|
|
virtualinherited |
◆ pre()
void ElementLoopUserObject::pre |
( |
| ) |
|
|
virtualinherited |
◆ preElement()
void ElementLoopUserObject::preElement |
( |
const Elem * |
elem | ) |
|
|
virtualinherited |
◆ reconstructElementSlope()
virtual void SlopeReconstructionBase::reconstructElementSlope |
( |
| ) |
|
|
pure virtual |
◆ serialize()
void SlopeReconstructionBase::serialize |
( |
std::string & |
serialized_buffer | ) |
|
|
protectedvirtual |
Definition at line 264 of file SlopeReconstructionBase.C.
266 std::ostringstream oss;
270 oss.write((
char *)&size,
sizeof(size));
274 storeHelper(oss, *it,
this);
275 storeHelper(oss,
_rslope[*it],
this);
279 serialized_buffer.assign(oss.str());
Referenced by finalize().
◆ subdomainChanged()
void ElementLoopUserObject::subdomainChanged |
( |
| ) |
|
|
virtualinherited |
◆ _avars
std::map<dof_id_type, std::vector<Real> >& SlopeReconstructionBase::_avars |
|
protected |
◆ _bnd_avars
std::map<std::pair<dof_id_type, unsigned int>, std::vector<Real> >& SlopeReconstructionBase::_bnd_avars |
|
protected |
◆ _bnd_side_area
std::map<std::pair<dof_id_type, unsigned int>, Real>& SlopeReconstructionBase::_bnd_side_area |
|
protected |
◆ _bnd_side_centroid
std::map<std::pair<dof_id_type, unsigned int>, Point>& SlopeReconstructionBase::_bnd_side_centroid |
|
protected |
◆ _bnd_side_normal
std::map<std::pair<dof_id_type, unsigned int>, Point>& SlopeReconstructionBase::_bnd_side_normal |
|
protected |
◆ _coord
const MooseArray<Real>& ElementLoopUserObject::_coord |
|
protectedinherited |
◆ _current_elem
const Elem* ElementLoopUserObject::_current_elem |
|
protectedinherited |
◆ _current_elem_volume
const Real& ElementLoopUserObject::_current_elem_volume |
|
protectedinherited |
◆ _current_neighbor
const Elem* ElementLoopUserObject::_current_neighbor |
|
protectedinherited |
◆ _current_side
unsigned int ElementLoopUserObject::_current_side |
|
protectedinherited |
◆ _have_interface_elems
bool ElementLoopUserObject::_have_interface_elems |
|
protectedinherited |
◆ _interface_elem_ids
std::set<dof_id_type> ElementLoopUserObject::_interface_elem_ids |
|
protectedinherited |
◆ _JxW
const MooseArray<Real>& ElementLoopUserObject::_JxW |
|
protectedinherited |
◆ _JxW_face
const MooseArray<Real>& SlopeReconstructionBase::_JxW_face |
|
protected |
◆ _mesh
MooseMesh& ElementLoopUserObject::_mesh |
|
protectedinherited |
◆ _mutex
Threads::spin_mutex SlopeReconstructionBase::_mutex |
|
staticprivate |
◆ _neighbor_elem
const Elem* const & SlopeReconstructionBase::_neighbor_elem |
|
protected |
◆ _normals_face
const MooseArray<Point>& SlopeReconstructionBase::_normals_face |
|
protected |
◆ _old_subdomain
SubdomainID ElementLoopUserObject::_old_subdomain |
|
protectedinherited |
◆ _q_point
const MooseArray<Point>& ElementLoopUserObject::_q_point |
|
protectedinherited |
◆ _q_point_face
const MooseArray<Point>& SlopeReconstructionBase::_q_point_face |
|
protected |
◆ _qrule
const QBase* const & ElementLoopUserObject::_qrule |
|
protectedinherited |
◆ _qrule_face
const QBase* const & SlopeReconstructionBase::_qrule_face |
|
protected |
◆ _rslope
std::map<dof_id_type, std::vector<RealGradient> >& SlopeReconstructionBase::_rslope |
|
protected |
◆ _side
const unsigned int& SlopeReconstructionBase::_side |
|
protected |
◆ _side_area
std::map<std::pair<dof_id_type, dof_id_type>, Real>& SlopeReconstructionBase::_side_area |
|
protected |
◆ _side_centroid
std::map<std::pair<dof_id_type, dof_id_type>, Point>& SlopeReconstructionBase::_side_centroid |
|
protected |
◆ _side_elem
const Elem* const & SlopeReconstructionBase::_side_elem |
|
protected |
◆ _side_geoinfo_cached
bool SlopeReconstructionBase::_side_geoinfo_cached |
|
protected |
◆ _side_normal
std::map<std::pair<dof_id_type, dof_id_type>, Point>& SlopeReconstructionBase::_side_normal |
|
protected |
◆ _side_volume
const Real& SlopeReconstructionBase::_side_volume |
|
protected |
◆ _subdomain
SubdomainID ElementLoopUserObject::_subdomain |
|
protectedinherited |
The documentation for this class was generated from the following files:
virtual void initialize()
virtual void computeInternalSide()
const Elem *const & _side_elem
std::map< std::pair< dof_id_type, dof_id_type >, Point > & _side_normal
store the side normal into this map indexed by pair of element ID and neighbor ID
virtual void computeBoundary()
unsigned int _current_side
std::map< std::pair< dof_id_type, unsigned int >, Point > & _bnd_side_normal
store the boundary side normal into this map indexed by pair of element ID and local side ID
const unsigned int & _side
current side of the current element
std::set< dof_id_type > _interface_elem_ids
List of element IDs that are on the processor boundary and need to be send to other processors.
static Threads::spin_mutex _mutex
bool _side_geoinfo_cached
flag to indicated if side geometry info is cached
const Elem *const & _neighbor_elem
the neighboring element
virtual void computeInterface()
std::map< dof_id_type, std::vector< RealGradient > > & _rslope
store the reconstructed slopes into this map indexed by element ID
const MooseArray< Real > & _JxW_face
const QBase *const & _qrule_face
SubdomainID _subdomain
The subdomain for the current element.
std::map< std::pair< dof_id_type, unsigned int >, Point > & _bnd_side_centroid
store the boundary side centroid into this map indexed by pair of element ID and local side ID
virtual void preElement(const Elem *elem)
std::map< std::pair< dof_id_type, dof_id_type >, Real > & _side_area
store the side area into this map indexed by pair of element ID and neighbor ID
const MooseArray< Point > & _q_point_face
required data for face assembly
virtual void serialize(std::string &serialized_buffer)
const Real & _side_volume
virtual void onBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id)
bool _have_interface_elems
true if we have cached interface elements, false if they need to be cached. We want to (re)cache only...
virtual void onElement(const Elem *elem)
std::map< std::pair< dof_id_type, dof_id_type >, Point > & _side_centroid
store the side centroid into this map indexed by pair of element ID and neighbor ID
virtual void onInternalSide(const Elem *elem, unsigned int side)
SubdomainID _old_subdomain
The subdomain for the last element.
virtual void caughtMooseException(MooseException &e)
virtual void onInterface(const Elem *elem, unsigned int side, BoundaryID bnd_id)
virtual void subdomainChanged()
virtual void computeElement()
std::map< std::pair< dof_id_type, unsigned int >, Real > & _bnd_side_area
store the boundary side area into this map indexed by pair of element ID and local side ID
const Elem * _current_elem
std::map< std::pair< dof_id_type, unsigned int >, std::vector< Real > > & _bnd_avars
store the boundary average variable values into this map indexed by pair of element ID and local side...
std::map< dof_id_type, std::vector< Real > > & _avars
store the average variable values into this map indexed by element ID
virtual void deserialize(std::vector< std::string > &serialized_buffers)
const Elem * _current_neighbor
ElementLoopUserObject(const InputParameters ¶meters)
virtual void meshChanged()
virtual void reconstructElementSlope()=0
compute the slope of the cell
const MooseArray< Point > & _normals_face