https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
22public:
24
26
27 void initialSetup() override;
28
33 struct StartElem
34 {
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
95protected:
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
123private:
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
141namespace libMesh
142{
143namespace Parallel
144{
145template <>
147{
148public:
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
boundary_id_type BoundaryID
unsigned int THREAD_ID
unsigned int RayDataIndex
Type for the index into the data and aux data on a Ray.
Definition Ray.h:52
const InputParameters & parameters() const
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...
RayTracingStudy used to generate Rays for view factor computation using the angular quadrature method...
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.
std::map< BoundaryID, std::map< BoundaryID, Real > > _vf_info
Cumulative view factor information; [from_bid][to_bid] = val.
const std::set< BoundaryID > _bnd_ids
The user supplied boundary IDs we need view factors on.
void initialSetup() override
RayDataIndex rayIndexStartBndID() const
Get the index in the Ray aux data for the starting boundary ID.
const RayDataIndex _ray_index_start_bnd_id
Index in the Ray aux data for the starting boundary ID.
std::vector< StartElem > _start_elems
The StartElem objects that this proc needs to spawn Rays from.
const std::vector< BoundaryID > _bnd_ids_vec
The vector of user supplied boundary IDs we need view factors on.
static InputParameters validParams()
Real viewFactorInfo(const BoundaryID from_id, const BoundaryID to_id) const
Accessor for the finalized view factor info.
std::unique_ptr< RayTracingAngularQuadrature > _3d_aq
const std::unique_ptr< libMesh::FEBase > _fe_face
Face FE used for creating face quadrature points and weights.
void generateRays() override
Subclasses should override this to determine how to generate Rays.
const std::unique_ptr< libMesh::QBase > _q_face
Face quadrature used for _fe_face.
void postExecuteStudy() override
Entry point after study execution.
void preExecuteStudy() override
Entry point before study execution.
std::vector< Real > _2d_aq_angles
angular quadrature info
const MooseEnum _internal_convention
The convention for spawning rays from internal sidesets.
std::vector< Real > _2d_aq_weights
const RayDataIndex _ray_index_start_total_weight
Index in the Ray aux data for the starting total weight (dot * qp weight)
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.
RayDataIndex rayIndexStartTotalWeight() const
Get the index in the Ray aux data for the starting total weight (dot * qp weight)
static ViewFactorRayStudy::StartElem unpack(BufferIter in, Context *)
static void pack(const ViewFactorRayStudy::StartElem &object, Iter data_out, const Context *)
static unsigned int packed_size(BufferIter iter)
unsigned int packable_size(const std::pair< T1, T2 > &pr, const Context *ctx)
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Data structure used for storing all of the information needed to spawn Rays from a single element.
const Elem * _start_elem
The element the trace will start from.
std::vector< Point > _points
The points on start_elem to spawn Rays from.
const Elem * _elem
The element the points originate from.
unsigned short int _incoming_side
The incoming side on start_elem that the trace will start from.
std::vector< Real > _weights
The weights associated with each point.
BoundaryID _bnd_id
The boundary ID associated with this start elem.
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)