https://mooseframework.inl.gov
RayTracingViewFactor.C
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 #include "RayTracingViewFactor.h"
11 
12 #include "ViewFactorRayStudy.h"
13 
14 registerMooseObject("HeatTransferApp", RayTracingViewFactor);
15 
18 {
20  params.addRequiredParam<UserObjectName>("ray_study_name",
21  "Name of the view factor ray study UO.");
22  params.addClassDescription("Computes view factors for arbitrary geometries using raytracing.");
23  return params;
24 }
25 
27  : ViewFactorBase(parameters), _ray_study(getUserObject<ViewFactorRayStudy>("ray_study_name"))
28 {
29  if (_mesh.dimension() == 1)
30  mooseError("View factor calculations do not support 1D");
31 }
32 
33 void
35 {
36  const auto & vf = static_cast<const RayTracingViewFactor &>(y);
37  for (unsigned int i = 0; i < _n_sides; ++i)
38  for (unsigned int j = 0; j < _n_sides; ++j)
39  _view_factors[i][j] += vf._view_factors[i][j];
40 }
41 
42 void
44 {
45  for (unsigned int i = 0; i < _n_sides; ++i)
47 
48  // get the _view_factors from ray study
49  for (const auto & from_name : boundaryNames())
50  for (const auto & to_name : boundaryNames())
51  {
52  unsigned int from_index = getSideNameIndex(from_name);
53  unsigned int to_index = getSideNameIndex(to_name);
54  BoundaryID from_id = _mesh.getBoundaryID(from_name);
55  BoundaryID to_id = _mesh.getBoundaryID(to_name);
56  _view_factors[from_index][to_index] = _ray_study.viewFactorInfo(from_id, to_id);
57  }
58 
59  // divide view_factor Fij by Ai and pi
60  const Real divisor = _mesh.dimension() == 2 ? 2 : libMesh::pi;
61  for (unsigned int i = 0; i < _n_sides; ++i)
62  {
63  const Real factor = 1. / (_areas[i] * divisor);
64  for (auto & vf : _view_factors[i])
65  vf *= factor;
66  }
67 }
void gatherSum(T &value)
static InputParameters validParams()
std::vector< Real > _areas
area of the sides i
unsigned int _n_sides
number of boundaries of this side uo
virtual void threadJoinViewFactor(const UserObject &y) override
a purely virtual function called in finalize, must be overriden by derived class
const std::vector< double > y
Computes the view factors for planar faces in unobstructed radiative heat transfer.
void addRequiredParam(const std::string &name, const std::string &doc_string)
A base class for automatic computation of view factors between sidesets.
registerMooseObject("HeatTransferApp", RayTracingViewFactor)
RayTracingStudy used to generate Rays for view factor computation using the angular quadrature method...
RayTracingViewFactor(const InputParameters &parameters)
std::vector< std::vector< Real > > _view_factors
the view factor from side i to side j
virtual unsigned int dimension() const
boundary_id_type BoundaryID
unsigned int getSideNameIndex(std::string name) const
helper function to get the index from the boundary name
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MooseMesh & _mesh
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
Real viewFactorInfo(const BoundaryID from_id, const BoundaryID to_id) const
Accessor for the finalized view factor info.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const ViewFactorRayStudy & _ray_study
const std::vector< BoundaryName > & boundaryNames() const
virtual void finalizeViewFactor() override
a purely virtural function called in finalize, must be overriden by derived class ...
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
const Real pi