https://mooseframework.inl.gov
HeatStructure2DRadiationCouplerRZ.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 
12 #include "HeatConductionNames.h"
13 #include "THMMesh.h"
14 
16 
19 {
21 
22  params.addRequiredParam<Real>("primary_emissivity", "Emissivity for the primary side");
23  params.addRequiredParam<Real>("secondary_emissivity", "Emissivity for the secondary side");
24  params.addParam<Real>("stefan_boltzmann_constant",
26  "Stefan Boltzmann constant [W/(m^2-K^4)]. This constant is provided as a "
27  "parameter to allow different precisions.");
28 
29  params.addClassDescription(
30  "Couples boundaries of two 2D cylindrical heat structures via radiation");
31 
32  return params;
33 }
34 
36  const InputParameters & parameters)
37  : HeatStructure2DCouplerBase(parameters),
38 
39  _emissivities({getParam<Real>("primary_emissivity"), getParam<Real>("secondary_emissivity")})
40 {
41 }
42 
43 void
45 {
47 
48  if (hasComponentByName<HeatStructureBase>(_hs_names[0]) &&
49  hasComponentByName<HeatStructureBase>(_hs_names[1]) && _hs_side_types.size() == 2)
50  {
51  _view_factors.resize(2);
52  if (_areas[0] > _areas[1])
53  {
54  _view_factors[0] = _areas[1] / _areas[0];
55  _view_factors[1] = 1.0;
56  }
57  else
58  {
59  _view_factors[0] = 1.0;
60  _view_factors[1] = _areas[0] / _areas[1];
61  }
62  }
63 }
64 
65 void
67 {
69 
70  if (!_is_cylindrical[0] || !_is_cylindrical[1])
71  logError("The primary and secondary heat structures must be of a type inherited from "
72  "'HeatStructureCylindricalBase'.");
73 
75  logError("The primary and secondary boundaries must be aligned.");
76 
77  if (hasComponentByName<HeatStructureBase>(_hs_names[0]) &&
78  hasComponentByName<HeatStructureBase>(_hs_names[1]))
79  {
80  const HeatStructureBase & primary_hs = getComponentByName<HeatStructureBase>(_hs_names[0]);
81  const HeatStructureBase & secondary_hs = getComponentByName<HeatStructureBase>(_hs_names[1]);
82  if (primary_hs.hasBoundary(_hs_boundaries[0]) && secondary_hs.hasBoundary(_hs_boundaries[1]))
83  {
88  logError("The primary and secondary boundaries must be radial boundaries.");
89  }
90  }
91 }
92 
93 void
95 {
97 
98  for (unsigned int i = 0; i < 2; i++)
99  {
100  const unsigned int j = i == 0 ? 1 : 0;
101 
102  const auto & hs_cyl = getComponentByName<HeatStructureCylindricalBase>(_hs_names[i]);
103 
104  const std::string class_name = "HeatStructure2DRadiationCouplerRZBC";
105  InputParameters params = _factory.getValidParams(class_name);
106  params.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE;
107  params.set<std::string>("coupled_variable") = HeatConductionModel::TEMPERATURE;
108  params.set<std::vector<BoundaryName>>("boundary") = {_hs_boundaries[i]};
109  params.set<MeshAlignment *>("_mesh_alignment") = &_mesh_alignment;
110  params.set<Real>("emissivity") = _emissivities[i];
111  params.set<Real>("coupled_emissivity") = _emissivities[j];
112  params.set<Real>("view_factor") = _view_factors[i];
113  params.set<Real>("area") = _areas[i];
114  params.set<Real>("coupled_area") = _areas[j];
115  params.set<Real>("stefan_boltzmann_constant") = getParam<Real>("stefan_boltzmann_constant");
116  params.set<Point>("axis_point") = hs_cyl.getPosition();
117  params.set<RealVectorValue>("axis_dir") = hs_cyl.getDirection();
118  getTHMProblem().addBoundaryCondition(class_name, genName(name(), class_name, i), params);
119  }
120 }
HeatStructure2DRadiationCouplerRZ(const InputParameters &parameters)
bool hasBoundary(const BoundaryName &boundary_name) const
Returns true if this component has the supplied boundary.
Definition: Component2D.C:473
static InputParameters validParams()
std::string genName(const std::string &prefix, unsigned int id, const std::string &suffix="") const
Build a name from a prefix, number and possible suffix.
const std::vector< BoundaryName > _hs_boundaries
Primary and secondary heat structure boundaries.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition: Component.C:135
registerMooseObject("ThermalHydraulicsApp", HeatStructure2DRadiationCouplerRZ)
T & set(const std::string &name, bool quiet_mode=false)
virtual void check() const override
Check the component integrity.
InputParameters getValidParams(const std::string &name) const
Couples boundaries of two 2D cylindrical heat structures via radiation.
Builds mapping between two aligned subdomains/boundaries.
Definition: MeshAlignment.h:24
virtual const std::string & name() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
bool meshesAreAligned() const
Returns true if the primary and secondary meshes are aligned.
virtual void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters &parameters)
void logError(Args &&... args) const
Logs an error.
Definition: Component.h:215
virtual void init() override
Initializes the component.
std::vector< bool > _is_cylindrical
Flag for each heat structure deriving from HeatStructureCylindricalBase.
virtual void init() override
Initializes the component.
static const std::string TEMPERATURE
std::vector< Real > _view_factors
View factors for the primary and secondary sides.
std::vector< Real > _areas
Areas for the primary and secondary sides.
const std::vector< Real > _emissivities
Emissivities for the primary and secondary sides.
std::vector< Component2D::ExternalBoundaryType > _hs_side_types
Heat structure side types for each boundary.
MeshAlignment _mesh_alignment
Mesh alignment.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Factory & _factory
The Factory associated with the MooseApp.
Definition: Component.h:446
Base class for 2D generated heat structures.
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
virtual void addMooseObjects()
Definition: Component.h:114
const std::vector< std::string > _hs_names
Primary and secondary heat structure names.
Couples boundaries of two 2D heat structures.
virtual void check() const override
Check the component integrity.