23 "The heat structures to couple");
25 "boundaries",
"The boundaries of the heat structures to couple");
28 "emissivities > 0 & emissivities < 1",
29 "Emissivities of each heat structure surface");
32 "view_factors >= 0 & view_factors <= 1",
33 "The view factors between each surface, as a matrix. The row/column ordering corresponds to " 34 "the ordering in 'heat_structures', with an additional row and column if " 35 "'include_environment' is set to 'true'. Each row must sum to one.");
37 "include_environment",
38 "Whether or not to include an environment surrounding all of the surfaces. If the heat " 39 "structure surfaces themselves form an enclosure, then set this parameter to 'false'.");
42 "Environment temperature [K]. Only set if 'include_environment' is set to true.");
44 params.
addClassDescription(
"Couples boundaries of multiple 2D heat structures via radiation");
52 _hs_names(getParam<
std::vector<
std::string>>(
"heat_structures")),
53 _hs_boundaries(getParam<
std::vector<BoundaryName>>(
"boundaries")),
54 _include_environment(getParam<bool>(
"include_environment")),
55 _n_hs(_hs_names.size()),
56 _n_surfaces(_include_environment ? _n_hs + 1 : _n_hs),
58 _mesh_alignment(constMesh())
60 for (
unsigned int i = 0; i <
_n_hs; ++i)
74 std::vector<std::vector<std::tuple<dof_id_type, unsigned short int>>> boundary_infos;
77 if (hasComponentByName<HeatStructureBase>(
_hs_names[i]))
79 const auto & hs = getComponentByName<HeatStructureBase>(
_hs_names[i]);
86 if (hasComponentByName<HeatStructureBase>(
_hs_names[0]))
88 const auto & hs = getComponentByName<HeatStructureBase>(
_hs_names[0]);
97 std::vector<dof_id_type> elem_ids;
98 elem_ids.push_back(primary_elem_id);
99 elem_ids.insert(elem_ids.end(), coupled_elem_ids.begin(), coupled_elem_ids.end());
101 for (
unsigned int i = 0; i < elem_ids.size(); ++i)
102 for (
unsigned int j = i + 1;
j < elem_ids.size(); ++
j)
113 checkEqualSize<BoundaryName, std::string>(
"boundaries",
"heat_structures");
114 checkEqualSize<Real, std::string>(
"emissivities",
"heat_structures");
117 const auto & view_factors = getParam<std::vector<std::vector<Real>>>(
"view_factors");
118 bool correct_size =
true;
123 correct_size =
false;
126 correct_size =
false;
128 logError(
"The parameter 'view_factors' must be a square matrix of size ",
130 ". For example, a size 2 matrix is provided as '0.2 0.8; 0.7 0.3'. The row/column " 131 "ordering corresponds to the ordering in 'heat_structures', with an additional " 132 "row/column if 'include_environment' is set to 'true'.");
135 bool all_row_sums_unity =
true;
138 std::accumulate(view_factors[i].begin(), view_factors[i].end(), 0.0), 1.0))
139 all_row_sums_unity =
false;
140 if (!all_row_sums_unity)
141 logError(
"All rows in 'view_factors' must sum to one.");
144 logError(
"The meshes of the heat structures are not aligned.");
149 checkComponentOfTypeExistsByName<HeatStructureCylindricalBase>(
_hs_names[i]);
151 if (hasComponentByName<HeatStructureBase>(
_hs_names[i]))
153 const auto & hs = getComponentByName<HeatStructureBase>(
_hs_names[i]);
157 "' does not have the boundary '",
168 const UserObjectName temperature_uo_name =
genName(
name(),
"temperature_uo");
170 const std::string class_name =
"StoreVariableByElemIDSideUserObject";
176 params.
set<
int>(
"execution_order_group") = -1;
181 const UserObjectName hs_coupler_2d2d_uo_name =
genName(
name(),
"uo");
183 const std::string class_name =
"HSCoupler2D2DRadiationUserObject";
187 parameters(), {
"emissivities",
"view_factors",
"include_environment",
"T_environment"});
188 params.
set<UserObjectName>(
"temperature_uo") = temperature_uo_name;
195 for (
unsigned int i = 0; i <
_n_hs; ++i)
197 const auto & hs = getComponentByName<HeatStructureCylindricalBase>(
_hs_names[i]);
199 const std::string class_name =
"HSCoupler2D2DRadiationRZBC";
203 params.
set<UserObjectName>(
"hs_coupler_2d2d_uo") = hs_coupler_2d2d_uo_name;
204 params.
set<Point>(
"axis_point") = hs.getPosition();
const unsigned int _n_hs
Number of heat structures.
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.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
static InputParameters validParams()
virtual void setupMesh()
Performs mesh setup such as creating mesh or naming mesh sets.
THMProblem & getTHMProblem() const
Gets the THM problem.
void addDependency(const std::string &dependency)
Adds a component name to the list of dependencies.
virtual void check() const override
Check the component integrity.
InputParameters getValidParams(const std::string &name) const
const std::vector< std::string > _hs_names
Heat structure names.
registerMooseObject("ThermalHydraulicsApp", HSCoupler2D2DRadiation)
Base class for components of a boundary type.
HSCoupler2D2DRadiation(const InputParameters ¶meters)
virtual const std::string & name() const
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 ¶meters)
void logError(Args &&... args) const
Logs an error.
virtual void check() const
Check the component integrity.
MeshAlignment2D2D _mesh_alignment
Mesh alignment object.
Couples boundaries of multiple 2D heat structures via radiation.
const std::vector< BoundaryName > _hs_boundaries
Heat structure boundary names.
Builds mapping between multiple 2D boundaries.
static const std::string TEMPERATURE
virtual void addMooseObjects() override
const std::vector< dof_id_type > & getPrimaryElemIDs() const
Returns the list of element IDs on the primary boundary.
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Factory & _factory
The Factory associated with the MooseApp.
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters ¶meters)
virtual void setupMesh() override
Performs mesh setup such as creating mesh or naming mesh sets.
const InputParameters & parameters() const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const std::vector< dof_id_type > & getCoupledSecondaryElemIDs(const dof_id_type &primary_elem_id) const
Gets the coupled secondary element IDs for a given primary element ID.
const unsigned int _n_surfaces
Number of surfaces.
static InputParameters validParams()
auto index_range(const T &sizable)
virtual void augmentSparsity(const dof_id_type &elem_id1, const dof_id_type &elem_id2)
Hint how to augment sparsity pattern between two elements.
void initialize(const std::vector< std::vector< std::tuple< dof_id_type, unsigned short int >>> &boundary_infos, const Point &axis_point, const RealVectorValue &axis_direction)
Extracts mesh information and builds the mapping.
const ExecFlagType EXEC_INITIAL