https://mooseframework.inl.gov
ViewFactorRayStudy.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 "RayTracingStudy.h"
13 
15 
21 {
22 public:
24 
26 
27  void initialSetup() override;
28 
33  struct StartElem
34  {
35  StartElem() {}
36 
37  StartElem(const Elem * elem,
38  const Elem * start_elem,
39  const unsigned short int incoming_side,
40  const BoundaryID bnd_id,
41  const std::vector<Point> & points,
42  const std::vector<Real> & weights)
43  : _elem(elem),
44  _start_elem(start_elem),
45  _incoming_side(incoming_side),
46  _bnd_id(bnd_id),
47  _points(points),
48  _weights(weights)
49  {
50  mooseAssert(_points.size() == _weights.size(), "Point and weight size not equal");
51  }
52 
54  const Elem * _elem;
56  const Elem * _start_elem;
58  unsigned short int _incoming_side;
62  std::vector<Point> _points;
64  std::vector<Real> _weights;
65  };
66 
74  void addToViewFactorInfo(Real value,
75  const BoundaryID from_id,
76  const BoundaryID to_id,
77  const THREAD_ID tid);
78 
84  Real viewFactorInfo(const BoundaryID from_id, const BoundaryID to_id) const;
85 
94 
95 protected:
96  void generateRays() override;
97  void preExecuteStudy() override;
98  void postExecuteStudy() override;
99 
100  void generateStartElems();
101 
103  const std::vector<BoundaryID> _bnd_ids_vec;
105  const std::set<BoundaryID> _bnd_ids;
106 
109 
114 
116  const std::unique_ptr<libMesh::FEBase> _fe_face;
118  const std::unique_ptr<libMesh::QBase> _q_face;
119 
120  // Whether or not the mesh is 3D
121  const bool _is_3d;
122 
123 private:
125  std::vector<std::unordered_map<BoundaryID, std::unordered_map<BoundaryID, Real>>>
128  std::map<BoundaryID, std::map<BoundaryID, Real>> _vf_info;
129 
131  std::vector<StartElem> _start_elems;
132 
134  std::vector<Real> _2d_aq_angles;
135  std::vector<Real> _2d_aq_weights;
136  std::unique_ptr<RayTracingAngularQuadrature> _3d_aq;
137  std::size_t _num_dir;
139 };
140 
141 namespace libMesh
142 {
143 namespace Parallel
144 {
145 template <>
146 class Packing<ViewFactorRayStudy::StartElem>
147 {
148 public:
149  typedef Real buffer_type;
150 
151  static unsigned int packing_size(const std::size_t num_points);
152 
153  static unsigned int packed_size(typename std::vector<Real>::const_iterator in);
154 
155  static unsigned int packable_size(const ViewFactorRayStudy::StartElem & start_elem, const void *);
156 
157  template <typename Iter, typename Context>
158  static void pack(const ViewFactorRayStudy::StartElem & object, Iter data_out, const Context *);
159 
160  template <typename BufferIter, typename Context>
161  static ViewFactorRayStudy::StartElem unpack(BufferIter in, Context *);
162 };
163 
164 } // namespace Parallel
165 
166 } // namespace libMesh
const Elem * _start_elem
The element the trace will start from.
const std::set< BoundaryID > _bnd_ids
The user supplied boundary IDs we need view factors on.
void initialSetup() override
std::vector< StartElem > _start_elems
The StartElem objects that this proc needs to spawn Rays from.
void addToViewFactorInfo(Real value, const BoundaryID from_id, const BoundaryID to_id, const THREAD_ID tid)
Adds into the view factor info; to be used in ViewFactorRayBC.
const std::vector< BoundaryID > _bnd_ids_vec
The vector of user supplied boundary IDs we need view factors on.
RayDataIndex rayIndexStartBndID() const
Get the index in the Ray aux data for the starting boundary ID.
std::vector< Real > _2d_aq_weights
void postExecuteStudy() override
Entry point after study execution.
std::unique_ptr< RayTracingAngularQuadrature > _3d_aq
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
ViewFactorRayStudy(const InputParameters &parameters)
void preExecuteStudy() override
Entry point before study execution.
static T unpack(BufferIter in, Context *ctx)
const std::unique_ptr< libMesh::QBase > _q_face
Face quadrature used for _fe_face.
static unsigned int packable_size(const T &object, const Context *context)
std::vector< Real > _weights
The weights associated with each point.
std::vector< Point > _points
The points on start_elem to spawn Rays from.
RayTracingStudy used to generate Rays for view factor computation using the angular quadrature method...
std::map< BoundaryID, std::map< BoundaryID, Real > > _vf_info
Cumulative view factor information; [from_bid][to_bid] = val.
std::vector< std::unordered_map< BoundaryID, std::unordered_map< BoundaryID, Real > > > _threaded_vf_info
View factor information by tid and then from/to pair; [tid][from_bid][to_bid] = val.
static InputParameters validParams()
unsigned int RayDataIndex
Type for the index into the data and aux data on a Ray.
Definition: Ray.h:51
const std::unique_ptr< libMesh::FEBase > _fe_face
Face FE used for creating face quadrature points and weights.
const Elem * _elem
The element the points originate from.
boundary_id_type BoundaryID
static unsigned int packed_size(BufferIter iter)
const RayDataIndex _ray_index_start_total_weight
Index in the Ray aux data for the starting total weight (dot * qp weight)
Context
static void pack(const T &object, OutputIter data_out, const Context *context)
const RayDataIndex _ray_index_start_bnd_id
Index in the Ray aux data for the starting boundary ID.
Data structure used for storing all of the information needed to spawn Rays from a single element...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MooseEnum _internal_convention
The convention for spawning rays from internal sidesets.
const InputParameters & parameters() const
BoundaryID _bnd_id
The boundary ID associated with this start elem.
Real viewFactorInfo(const BoundaryID from_id, const BoundaryID to_id) const
Accessor for the finalized view factor info.
StartElem(const Elem *elem, const Elem *start_elem, const unsigned short int incoming_side, const BoundaryID bnd_id, const std::vector< Point > &points, const std::vector< Real > &weights)
std::vector< Real > _2d_aq_angles
angular quadrature info
unsigned short int _incoming_side
The incoming side on start_elem that the trace will start from.
void generateRays() override
Subclasses should override this to determine how to generate Rays.
RayDataIndex rayIndexStartTotalWeight() const
Get the index in the Ray aux data for the starting total weight (dot * qp weight) ...
unsigned int THREAD_ID
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...