https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
11
12#include "ViewFactorRayStudy.h"
13
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
33void
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
42void
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}
boundary_id_type BoundaryID
const std::vector< double > y
registerMooseObject("HeatTransferApp", RayTracingViewFactor)
const std::vector< BoundaryName > & boundaryNames() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const
virtual unsigned int dimension() const
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Computes the view factors for planar faces in unobstructed radiative heat transfer.
RayTracingViewFactor(const InputParameters &parameters)
virtual void finalizeViewFactor() override
a purely virtural function called in finalize, must be overriden by derived class
const ViewFactorRayStudy & _ray_study
virtual void threadJoinViewFactor(const UserObject &y) override
a purely virtual function called in finalize, must be overriden by derived class
static InputParameters validParams()
MooseMesh & _mesh
void gatherSum(T &value)
A base class for automatic computation of view factors between sidesets.
unsigned int getSideNameIndex(std::string name) const
helper function to get the index from the boundary name
std::vector< std::vector< Real > > _view_factors
the view factor from side i to side j
unsigned int _n_sides
number of boundaries of this side uo
std::vector< Real > _areas
area of the sides i
static InputParameters validParams()
RayTracingStudy used to generate Rays for view factor computation using the angular quadrature method...
Real viewFactorInfo(const BoundaryID from_id, const BoundaryID to_id) const
Accessor for the finalized view factor info.
const Real pi