https://mooseframework.inl.gov
ConstantViewFactorSurfaceRadiation.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 
13 
16 {
18  params.addRequiredParam<std::vector<std::vector<Real>>>(
19  "view_factors", "The view factors from sideset i to sideset j.");
20  params.addClassDescription(
21  "ConstantViewFactorSurfaceRadiation computes radiative heat transfer between side sets and "
22  "the view factors are provided in the input file");
23  return params;
24 }
25 
27  const InputParameters & parameters)
29 {
30 }
31 
32 std::vector<std::vector<Real>>
34 {
35  std::vector<std::vector<Real>> vf = getParam<std::vector<std::vector<Real>>>("view_factors");
36 
37  // check that the input has the right format
38  if (vf.size() != _n_sides)
39  paramError("view_factors",
40  "Leading dimension of view_factors must be equal to number of side sets.");
41 
42  for (unsigned int i = 0; i < _n_sides; ++i)
43  if (vf[i].size() != _n_sides)
44  paramError("view_factors",
45  "view_factors must be provided as square array. Row ",
46  i,
47  " has ",
48  vf[i].size(),
49  " entries.");
50  return vf;
51 }
52 
53 void
55 {
57 
58  // check row-sum and normalize if necessary
59  for (unsigned int i = 0; i < _n_sides; ++i)
60  {
61  Real sum = 0;
62  for (auto & v : _view_factors[i])
63  sum += v;
64 
65  // an error of 5% is acceptable, but more indicates an error in the
66  // problem setup
67  if (std::abs(sum - 1) > 0.05)
68  mooseError("view_factors row ", i, " sums to ", sum);
69 
70  // correct view factors
71  for (auto & v : _view_factors[i])
72  v /= sum;
73  }
74 }
GrayLambertSurfaceRadiationBase computes the heat flux on a set of surfaces in radiative heat transfe...
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual std::vector< std::vector< Real > > setViewFactors() override
a purely virtual function that defines where view factors come from
ConstantViewFactorSurfaceRadiation(const InputParameters &parameters)
void paramError(const std::string &param, Args... args) const
registerMooseObject("HeatTransferApp", ConstantViewFactorSurfaceRadiation)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:84
unsigned int _n_sides
number of active boundary ids
std::vector< std::vector< Real > > _view_factors
the view factors which are set by setViewFactors by derived classes
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
ConstantViewFactorSurfaceRadiation computes radiative heat transfer between side sets and the view fa...